Java Guava | Shorts.asList() method with Examples Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 the list returned by the method and vice-versa. Syntax: public static List<Short> asList(short... backingArray) Parameter: The method accepts a mandatory parameter backingArray which is a short array that is used to back the list. Return Value: The method Shorts.asList() returns a fixed-size list which is backed by the array passed as the argument to the method. In other words, the method returns the list view of the array. Below examples illustrate the implementation of above method: Example 1: Java // Java code to show implementation of // Guava's Shorts.asList() method import com.google.common.primitives.Shorts; import java.util.List; class GFG { // Driver's code public static void main(String[] args) { // Creating a Short array short arr[] = { 1, 2, 3, 4, 5 }; // Using Shorts.asList() method to wrap // the specified primitive Short array // as a List of the Short type List<Short> myList = Shorts.asList(arr); // Displaying the elements in List System.out.println(myList); } } Output: [1, 2, 3, 4, 5] Example 2: Java // Java code to show implementation of // Guava's Shorts.asList() method import com.google.common.primitives.Shorts; import java.util.List; class GFG { // Driver's code public static void main(String[] args) { // Creating a Short array short arr[] = { 3, 5, 7 }; // Using Shorts.asList() method to wrap // the specified primitive Short array // as a List of the Short type List<Short> myList = Shorts.asList(arr); // Displaying the elements in List System.out.println(myList); } } Output: [3, 5, 7] Reference: https://guava.dev/releases/23.0/api/docs/com/google/common/primitives/Shorts.html#asList-short...- Comment More infoAdvertise with us Next Article Java Guava | Shorts.min() method with Examples S Sahil_Bansall Follow Improve Article Tags : Java java-guava Guava-Functions Guava-Shorts Practice Tags : Java Similar Reads Java Guava | Shorts.concat() method with Examples 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) H 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 | Shorts.max() method with Examples Shorts.max() is a method of Shorts class in Guava library which is used to find the greatest value present in an array. The value returned by this method is the largest short value in the specified array. Syntax: public static short max(short... array) Parameters: This method takes a mandatory param 2 min read Java Guava | Longs.asList() method with Examples The Longs.asList() method of Guava's Longs Class accepts a long array as a parameter and returns a list which has the fixed size. The returned list is backed by the long array which is passed as the argument. It means the changes made in the array passed as parameter will be reflected back in the li 2 min read Java Guava | Bytes.asList() method with Examples The Bytes.asList() method of Guava's Bytes Class accepts a byte array as a parameter and returns a list which has the fixed size. The returned list is backed by the byte array which is passed as the argument. It means the changes made in the array passed as parameter will be reflected back in the li 2 min read Java Guava | Chars.asList() method with Examples The Chars.asList() method of Guava's Chars Class accepts a char array as a parameter and returns a list which has the fixed size. The returned list is backed by the char array which is passed as the argument. It means the changes made in the array passed as parameter will be reflected back in the li 2 min read Like