Trusted answers to developer questions

What is a Java list?

Get Started With Data Science

Learn the fundamentals of Data Science with this free course. Future-proof your career by adding Data Science skills to your toolkit — or prepare to land a job in AI, Machine Learning, or Data Analysis.

In Java, a list interface is an ordered collection of objects in which duplicate values can be stored. Since a List preserves the insertion order, it allows positional access and insertion of elements.

List interface is implemented by the following classes:

Creating list objects

A list is an interface and the instances of a list can be created in the following ways:

  • listType is the class that is implementing the list interface.
  • objType is the data type of the values in the list
  • listName is the name of the list
// Obj is the type of object to be stored in List.
ListType<objType> listName = new ListType<objType> ();

RELATED TAGS

java
list
Copyright ©2024 Educative, Inc. All rights reserved
Did you find this helpful?