The asList() method of java.util.Arrays class is used to return a fixed-size list backed by the specified array.
This method acts as bridge between array-based and collection-based APIs, in combination with Collection.toArray(). The returned list is serializable and implements RandomAccess.
public static List asList(T... a)
Parameters: This method takes the array a which is required to be converted into a List.
Return Value: This method returns a list view of the specified array.
Below are the examples to illustrate the asList() method.
The list is: [A, B, C, D]
The list is: [10, 20, 30, 40]
- Java Guava | Longs.asList() method with Examples
- Java Guava | Booleans.asList() method with Examples
- Java Guava | Shorts.asList() method with Examples
- Java Guava | Chars.asList() method with Examples
- Java Guava | Floats.asList() method with Examples
- Java Guava | Bytes.asList() method with Examples
- Java Guava | Doubles.asList() method with Examples
- Java 8 | Arrays parallelSort() method with Examples
- Ints asList() function | Guava | Java
- Java.util.Arrays.equals() in Java with Examples
- Arrays.fill() in Java with Examples
- Arrays.sort() in Java with examples
- Arrays.binarySearch() in Java with examples | Set 1
- Arrays.toString() in Java with Examples
- Arrays copyOf() in Java with examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.