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 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.binarySearch() in Java with examples | Set 1
- Arrays copyOf() in Java with examples
- Arrays.toString() in Java with Examples
- Arrays.sort() in Java with examples
- util.Arrays vs reflect.Array in Java with Examples
- Arrays.binarySearch() in Java with examples | Set 2 (Search in subarray)
- Arrays stream() method in Java
- Java lang.Long.byteValue() method in Java with Examples
- Java lang.Long.numberOfLeadingZeros() method in Java with Examples
- Java lang.Long.highestOneBit() method in Java with Examples
- Java lang.Long.numberOfTrailingZeros() method 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.