Return List
Initializing a List in Java
The Java.util.List is a child interface of Collection. It is an ordered collection of objects in which duplicate values can be stored. Since List preserves the insertion order, it allows positional access and insertion of elements. List Interface is implemented by ArrayList, LinkedList, Vector and Stack classes. Show List is an interface, and the instances of List can be created in the following ways: List a = new ArrayList(); List b = new LinkedList(); List c = new Vector(); List d = new Stack();Below are the following ways to initialize a list:
|