Guava’s Ints.asList() returns a fixed-size list backed by the specified array.
public static List<Integer> asList(int array)
Parameters: This method takes the array as parameter which is the array to back the list.
Return Value: This method returns a fixed-size list backed by the specified array.
List of given array: [1, 2, 3, 4, 5]
List of given array: [3, 5, 7]
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.