Java Guava | Shorts.concat() method with Examples Last Updated : 24 Jan, 2019 Comments Improve Suggest changes Like Article Like Report Shorts.concat() is a method of Shorts class in Guava library which is used to concatenate the values of multiple arrays into a single array. For example, concat(new short[] {a, b}, new short[] {}, new short[] {c} returns the array {a, b, c}. Syntax : public static short[] concat(short[]... arrays) Here, arrays represent zero or more short arrays. Return Value: A single array containing all the values from the source arrays, in order. Example-1: Java // Java code to show implementation of // Guava's Shorts.concat() method import com.google.common.primitives.Shorts; import java.util.Arrays; class GFG { // Driver's code public static void main(String[] args) { // Creating 2 short arrays short[] arr1 = { 1, 2, 3, 4, 5 }; short[] arr2 = { 6, 2, 7, 0, 8 }; // Using Shorts.concat() method to combine // elements from both arrays into a single array short[] res = Shorts.concat(arr1, arr2); // Displaying the single combined array System.out.println(Arrays.toString(res)); } } Output: [1, 2, 3, 4, 5, 6, 2, 7, 0, 8] Example-2: Java // Java code to show implementation of // Guava's Shorts.concat() method import com.google.common.primitives.Shorts; import java.util.Arrays; class GFG { // Driver's code public static void main(String[] args) { // Creating 4 short arrays short[] arr1 = { 1, 2, 3 }; short[] arr2 = { 4, 5 }; short[] arr3 = { 6, 7, 8 }; short[] arr4 = { 9, 0 }; // Using Shorts.concat() method to combine // elements from both arrays into a single array short[] res = Shorts.concat(arr1, arr2, arr3, arr4); // Displaying the single combined array System.out.println(Arrays.toString(res)); } } Output: [1, 2, 3, 4, 5, 6, 7, 8, 9, 0] Reference: https://google.github.io/guava/releases/23.0/api/docs/com/google/common/primitives/Shorts.html#concat-short:A...- Comment More infoAdvertise with us Next Article Java Guava | Shorts.concat() method with Examples S Sahil_Bansall Follow Improve Article Tags : Java Practice Tags : Java Similar Reads Java Guava | Shorts.asList() method with Examples The Shorts.asList() method of Guava's Shorts Class accepts a short array as a parameter and returns a list which has the fixed size. The returned list is backed by the short array which is passed as the argument. It means the changes made in the array passed as parameter will be reflected back in th 2 min read Java Guava | Shorts.min() method with Examples Shorts.min() method of Guava's Shorts Class is used to find the least value present in an array. The value returned by this method is the smallest short value in the specified array. Syntax: public static short min(short... array) Parameters: This method takes a mandatory parameter array which is a 2 min read Java Guava | Longs.concat() method with Examples The concat() method of Longs Class in the Guava library is used to concatenate the values of many arrays into a single array. These long arrays to be concatenated are specified as parameters to this method. For example: concat(new long[] {1, 2}, new long[] {3, 4, 5}, new long[] {6, 7} returns the ar 3 min read Java Guava | Shorts.toArray() method with Examples The toArray() method of Shorts Class in the Guava library is used to convert the short values, passed as the parameter to this method, into a Short Array. These short values are passed as a Collection to this method. This method returns a Short array. Syntax: public static short[] toArray(Collection 2 min read Java String concat() Method with Examples The string concat() method concatenates (appends) a string to the end of another string. It returns the combined string. It is used for string concatenation in Java. It returns NullPointerException if any one of the strings is Null.In this article, we will learn how to concatenate two strings in Jav 4 min read Like