com.google.common.collect Lists is a part of the Guava library that provides a set of convenient utility classes for working with and manipulating collections. Lists.asList is a method that creates an immutable list containing all of the elements in the specified array. The method is overloaded, allowing users to provide an additional argument to specify the size of the returned list.
Example 1: Creating an immutable list from an array of strings
List list = Lists.asList("apple", "banana", "orange", "kiwi", "pineapple");
Example 2: Creating an immutable list from an array of integers, specifying the size of the returned list
List list = Lists.asList(1, new Integer[] { 2, 3, 4, 5, 6 });
The package library for com.google.common.collect is Guava, which is an open-source Java library developed by Google for making Java development easier and more productive.
Java Lists.asList - 17 examples found. These are the top rated real world Java examples of com.google.common.collect.Lists.asList extracted from open source projects. You can rate examples to help us improve the quality of examples.