List myList = new ArrayList();

or with generics (Java 7 or later)

List<MyType> myList = new ArrayList<>();

or with generics (Old java versions)

List<MyType> myList = new ArrayList<MyType>();
Answer from Dan Vinton on Stack Overflow
🌐
W3Schools
w3schools.com › java › java_list.asp
Java List
Java Examples Java Videos Java Compiler Java Exercises Java Quiz Java Code Challenges Java Server Java Syllabus Java Study Plan Java Interview Q&A Java Certificate ... The List interface is part of the Java Collections Framework and represents an ordered collection of elements.
🌐
GeeksforGeeks
geeksforgeeks.org › java › list-interface-java-examples
List Interface in Java - GeeksforGeeks
Explanation: This Java program demonstrates how to create a List using ArrayList, add elements to it, and iterate through the list to print each element. It uses an enhanced for loop to display all the stored programming languages. public interface List<E> extends Collection<E> { } To use a List, we must instantiate a class that implements it. Example classes that implement it are ArrayList and LinkedList
Published   February 3, 2026
🌐
freeCodeCamp
freecodecamp.org › news › how-lists-work-in-java
Java List – Example Lists in Java
January 31, 2023 - Although the ArrayList and LinkedList classes both have the same methods as seen in the examples in this article, the LinkedList class has some additional methods like: addFirst() adds an element at the beginning of the list. ... In this article, we talked about the List interface in Java.
🌐
CodeJava
codejava.net › java-core › collections › java-list-collection-tutorial-and-examples
Java List Collection Tutorial and Examples
February 10, 2025 - The following picture illustrates a list that stores some String elements:A list can store objects of any types. Primitive types are automatically converted to corresponding wrapper types, e.g. integer numbers are converted to Integer objects. It allows null and duplicate elements, and orders them by their insertion order (index).The following class diagram depicts the primary methods defined in the java.util.List interface:The List is the base interface for all list types, and the ArrayList and LinkedList classes are two common List’s implementations.
🌐
Oracle
docs.oracle.com › javase › tutorial › collections › interfaces › list.html
The List Interface (The Java™ Tutorials > Collections > Interfaces)
Taking advantage of Arrays.asList ... public class Shuffle { public static void main(String[] args) { List<String> list = Arrays.asList(args); Collections.shuffle(list); System.out.println(list); } }...
🌐
DigitalOcean
digitalocean.com › community › tutorials › java-list
Java List Interface: Complete Guide with Examples | DigitalOcean
August 3, 2022 - List interface got many default methods in Java 8, for example replaceAll, sort and spliterator.
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › util › List.html
List (Java Platform SE 8 )
3 weeks ago - This method eliminates the need for explicit range operations (of the sort that commonly exist for arrays). Any operation that expects a list can be used as a range operation by passing a subList view instead of a whole list. For example, the following idiom removes a range of elements from a list:
Find elsewhere
🌐
Programiz
programiz.com › java-programming › list
Java List Interface
These classes are defined in the Collections framework and implement the List interface. In Java, we must import java.util.List package in order to use List.
🌐
W3Schools
w3schools.com › java › java_arraylist.asp
Java ArrayList
Java Examples Java Videos Java Compiler Java Exercises Java Quiz Java Code Challenges Java Server Java Syllabus Java Study Plan Java Interview Q&A Java Certificate ... An ArrayList is like a resizable array. It is part of the java.util package and implements the List interface.
🌐
CodeGym
codegym.cc › java blog › java collections › java list
Java List
February 14, 2025 - By default, you could call list.sort(null) to sort in natural order, but you can also provide a custom comparator to control the sorting logic. This is super handy when you need a custom ordering. Let’s look at an example using a comparator to sort integers in descending order: import java.util.ArrayList; import java.util.List; public class ListSortExample { public static void main(String[] args) { List
🌐
Tutorialspoint
tutorialspoint.com › java › java_list_interface.htm
Java - List Interface
import java.util.LinkedList; import java.util.List; public class CollectionsDemo { public static void main(String[] args) { List<String> a1 = new LinkedList<>(); a1.add("Zara"); a1.add("Mahnaz"); a1.add("Ayan"); System.out.println(" LinkedList ...
🌐
Oracle
docs.oracle.com › javase › tutorial › uiswing › components › list.html
How to Use Lists (The Java™ Tutorials > Creating a GUI With Swing > Using Swing Components)
The examples in this page use DefaultListModel. AbstractListModel — you manage the data and invoke the "fire" methods. For this approach, you must subclass AbstractListModel and implement the getSize and getElementAt methods inherited from the ListModel interface. ListModel — you manage everything. Here is the code from ListDialog.java that creates and sets up its list:
🌐
Oracle
docs.oracle.com › en › java › javase › 21 › docs › api › java.base › java › util › List.html
List (Java SE 21 & JDK 21)
January 20, 2026 - For example, in a future release, synchronization may fail. Callers should make no assumptions about the identity of the returned instances. Factories are free to create new instances or reuse existing ones. They are serialized as specified on the Serialized Form page. This interface is a member of the Java Collections Framework. ... Inserts the specified element at the specified position in this list (optional operation).
🌐
Jenkov
jenkov.com › tutorials › java-collections › list.html
Java List
This example adds all elements from listSource into listDest. The addAll() method takes a Collection as parameter, so you can pass either a List or Java Set as parameter.
🌐
Software Testing Help
softwaretestinghelp.com › home › java › java list – how to create, initialize & use list in java
Java List - How To Create, Initialize & Use List In Java
April 1, 2025 - This Java List Tutorial Explains How to Create, Initialize and Print Lists in Java. The tutorial also Explains List of Lists with Complete Code Example.
🌐
Javatpoint
javatpoint.com › java-list
Java List Interface - javatpoint
Java Deque A deque is a linear collection that supports insertion and deletion of elements from both the ends. The name 'deque' is an abbreviation for double-ended queue. There are no fixed limits on the deque for the number of elements they may contain.
🌐
Simplilearn
simplilearn.com › home › resources › software development › an introduction to list in java
An Introduction to List in Java [With Examples]
May 11, 2021 - List in Java provides a way to maintain the ordered collection, and contains the index-based method to insert, delete, update, etc. Learn about list in java!
Address   5851 Legacy Circle, 6th Floor, Plano, TX 75024 United States
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-use-lists-in-java
How To Use Lists in Java | DigitalOcean
January 19, 2024 - In the following example, you will create a list using the ArrayList implementation and containing String objects. Open jshell and type: Info: To follow the example code in this tutorial, open the Java Shell tool on your local system by running the jshell command.
🌐
Oracle
docs.oracle.com › javase › tutorial › collections › implementations › list.html
List Implementations (The Java™ Tutorials > Collections > Implementations)
Most of the time, you'll probably use ArrayList, which offers constant-time positional access and is just plain fast. It does not have to allocate a node object for each element in the List, and it can take advantage of System.arraycopy when it has to move multiple elements at the same time.