Neither. According to the docs for List.of() it returns:

Returns an immutable list containing an arbitrary number of elements.

Note that it is the interface List that ArrayList and LinkedList implement

If we run this code:

List<Integer> listOf = List.of(1,2,3);
System.out.println(listOf.getClass());

We get:

class java.util.ImmutableCollections$ListN
Answer from GBlodgett on Stack Overflow
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › util › List.html
List (Java Platform SE 8 )
October 20, 2025 - The List interface provides four methods for positional (indexed) access to list elements. Lists (like Java arrays) are zero based. Note that these operations may execute in time proportional to the index value for some implementations (the LinkedList class, for example).
🌐
W3Schools
w3schools.com › java › java_list.asp
Java List
Java OOP Java Classes/Objects Java Class Attributes Java Class Methods Java Class Challenge Java Constructors Java this Keyword Java Modifiers · Access Modifiers Non-Access Modifiers Java Encapsulation Java Packages / API Java Inheritance Java Polymorphism Java super Keyword Java Inner Classes Java Abstraction Java Interface Java Anonymous Java Enum ... Java Data Structures Java Collections Java List Java ArrayList Java LinkedList Java List Sorting Java Set Java HashSet Java TreeSet Java LinkedHashSet Java Map Java HashMap Java TreeMap Java LinkedHashMap Java Iterator Java Algorithms
Discussions

What type of list is generated by List.of() in Java - Stack Overflow
Neither. It's a good idea to look at the implementation of that method. ... It is similar to an ArrayList, in that it is a list backed by an array. However, it does not have the same runtime properties as a java.util.ArrayList, e.g. More on stackoverflow.com
🌐 stackoverflow.com
How to make a new List in Java - Stack Overflow
We create a Set as: Set myset = new HashSet() How do we create a List in Java? More on stackoverflow.com
🌐 stackoverflow.com
[Java] When to use List, ArrayList etc. ?
Bad analogy: Using List is like saying "could you pick up peanut butter from the store?" Using ArrayList is like saying "could you pick up some Skippy®™ in the 16oz size from the store?" List is an interface. It can be used to refer to any class that implements the given set of methods and behaviors. ArrayList is a specific implementation of that interface that is backed by an array. You don't necessarily need to use an array to implement the interface, you could use a linked list (i.e. LinkedList.) For example, if some method takes List as a parameter type then it's saying "I don't care what kind, as long as it's got the basic properties of a list." If a method takes ArrayList then it's hinting that there is no such flexibility, and it must be this particular implementation of a list. And you can't instantiate List. Your example is not doing that. In both cases you are instantiating ArrayList. That's the type that is used with new. The type of the reference does not have to be the same as the type of the referent. You are creating two references of different types, but they both refer to objects of type ArrayList. More on reddit.com
🌐 r/learnprogramming
10
39
April 9, 2016
collections - How to create list filled with methods in Java and iterate over it (using methods) - Stack Overflow
I want to be able to create list (collection, array) filled with my own methods and in each step of iteration call the method. What's the best solution for this? I want something like this: List ... More on stackoverflow.com
🌐 stackoverflow.com
People also ask

Can a Java List store primitive data types?

No, Lists can only store objects. Use wrapper classes like Integer or Double.

🌐
ultahost.com
ultahost.com › knowledge-base › java-list-examples
Understanding Java List Usage with Examples | Ultahost Knowledge Base
What is the main difference between a Java List and an array?

A List can grow or shrink in size, while an array has a fixed length once created.

🌐
ultahost.com
ultahost.com › knowledge-base › java-list-examples
Understanding Java List Usage with Examples | Ultahost Knowledge Base
When should I prefer LinkedList over ArrayList?

Choose LinkedList when frequent insertions or deletions are needed, especially in the middle of the list.

🌐
ultahost.com
ultahost.com › knowledge-base › java-list-examples
Understanding Java List Usage with Examples | Ultahost Knowledge Base
🌐
GeeksforGeeks
geeksforgeeks.org › java › list-interface-java-examples
List Interface in Java - GeeksforGeeks
This method is overloaded to perform multiple operations based on different parameters. remove(Object o): Removes the first occurrence of the specified object from the list. remove(int index): Removes the element at the specified index and shifts subsequent elements left. ... import java.util.ArrayList; import java.util.List; class Geeks { public static void main(String args[]) { // Creating List class object List<String> al = new ArrayList<>(); // Adding elements to the object Custom inputs al.add("Geeks"); al.add("Geeks"); // Adding For at 1st indexes al.add(1, "For"); System.out.println("Initial ArrayList " + al); // Now remove element from the above list present at 1st index al.remove(1); System.out.println("After the Index Removal " + al); // Now remove the current object from the updated List al.remove("Geeks"); System.out.println("After the Object Removal " + al); } }
Published   February 3, 2026
🌐
Linux Hint
linuxhint.com › different_list_methods_java
Java List Tutorial
The list is called an ordered collection, and it is an interface that extends the Collection interface. The list is a useful way to store ordered multiple data like an array in Java. ArrayList and LinkList classes are widely used in Java. The insert, update, delete, and search operations are ...
🌐
UltaHost
ultahost.com › knowledge-base › java-list-examples
Understanding Java List Usage with Examples | Ultahost Knowledge Base
May 17, 2025 - The Java List interface provides a contract for ordered collections that contain duplicates. The List interface extends Collection and introduces methods to control what can be placed into the collection and where.
Find elsewhere
🌐
IONOS
ionos.com › digital guide › websites › web development › java list
What is a Java list? - IONOS
November 3, 2023 - You can add, modify, delete or query elements in a list. Java lists can contain objects that belong to different classes. It’s also possible to store duplicate elements or null elements. Ad­di­tion­al­ly, Java lists support generic classes and methods, ensuring type safety.
🌐
Coderanch
coderanch.com › t › 669231 › java › java-list-objects-methods
java list with objects and methods (Beginning Java forum at Coderanch)
August 13, 2016 - how does the method makeEmpty know what seat to make empty The makeEmpty() method is in the Seat class. It changes the values for the one instance of the Seat class. The code on line 80 uses a reference to an instance of the Seat class to call its makeEmpty() method.
🌐
Amigoscode
blog.amigoscode.com › p › 18-most-used-java-list-methods
18 Most Used Java List Methods
December 14, 2023 - It represents an ordered collection ... elements. The List interface provides methods to add, remove, access, and manipulate elements based on their position in the list....
🌐
MangoHost
mangohost.net › mangohost blog › java list – how to use and manipulate lists
Java List – How to Use and Manipulate Lists
August 4, 2025 - Understanding performance characteristics is crucial for selecting the right List implementation. Here’s a detailed comparison: Let’s dive into practical implementations that you’ll commonly encounter in server-side development and system administration tasks. import java.util.*; import java.util.stream.Collectors; public class ListManipulationExample { public static void main(String[] args) { // Initialize with values List<String> serverList = Arrays.asList("web01", "web02", "db01", "cache01"); // Convert to mutable list (Arrays.asList returns immutable) List<String> mutableServerList =
🌐
Java Programming
java-programming.mooc.fi › part-3 › 2-lists
Lists - Java Programming
ArrayList is a pre-made tool in Java that helps dealing with lists. It offers various methods, including ones for adding values to the list, removing values from it, and also for the retrieval of a value from a specific place in the list.
🌐
DigitalOcean
digitalocean.com › community › tutorials › java-list
Java List - List in Java | DigitalOcean
August 3, 2022 - Java List interface is a member of the Java Collections Framework. List allows you to add duplicate elements. List allows you to have ‘null’ elements. List interface got many default methods in Java 8, for example replaceAll, sort and spliterator.
🌐
W3Schools
w3schools.com › java › java_ref_arraylist.asp
Java ArrayList Methods
Some methods use the type of the ArrayList's items as a parameter or return value. This type will be referred to as T in the table. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com · If you want to report an error, or if you want to make a suggestion, send us an e-mail: help@w3schools.com · HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP Tutorial Java Tutorial C++ Tutorial jQuery Tutorial
🌐
Baeldung
baeldung.com › home › java › java list › java list initialization in one line
Java List Initialization in One Line | Baeldung
April 4, 2025 - In this quick tutorial, we'll investigate how can we initialize a List using one-liners.
🌐
CodeGym
codegym.cc › java blog › java collections › java list
Java List
February 14, 2025 - The Collections.sort() method is the classic approach. When used on a List of objects that implement Comparable, it sorts the list in ascending order based on the compareTo() method of the objects.
🌐
DigitalOcean
digitalocean.com › community › tutorials › java-list-add-addall-methods
How To Use add() and addAll() Methods for Java List | DigitalOcean
September 10, 2025 - Memory efficiency: Reduces method call overhead and potential array resizing · Optimized implementations: ArrayList can pre-allocate space for bulk additions ... package com.journaldev.examples; import java.util.*; import java.util.stream.Collectors; public class ListAddAllExamples { public static void main(String[] args) { // Example 1: Basic addAll() operations List<Integer> primeNumbers = new ArrayList<>(); primeNumbers.addAll(Arrays.asList(2, 7, 11)); System.out.println("After adding [2, 7, 11]: " + primeNumbers); primeNumbers.addAll(1, Arrays.asList(3, 5)); System.out.println("After inse
🌐
iO Flood
ioflood.com › blog › list-java
List in Java: Your Ultimate Usage Guide
February 27, 2024 - ArrayList<String> list = new ArrayList<String>(); list.add('Hello'); System.out.println(list.get(1)); /* Output: Exception in thread 'main' java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 */ In the code above, we’re trying to access the second element (index 1) in a list that only contains one element. This throws an IndexOutOfBoundsException. To avoid this, always ensure that the index you’re trying to access exists. You can check the size of the list using the size() method:
🌐
Reddit
reddit.com › r/learnprogramming › [java] when to use list, arraylist etc. ?
r/learnprogramming on Reddit: [Java] When to use List, ArrayList etc. ?
April 9, 2016 -

Hey,

so I'm a little bit confused here. There are a lot of lists and I don't really get what's the difference or when I should instantiate a List as an ArrayList or when to instantiate an ArrayList as a List etc. I hope you get what I mean. Here is a code example I wrote:

public class ListTest {
    public static void main(String args[]){
        List<String> list1 = new ArrayList<String>();
        ArrayList<String> list2 = new ArrayList<String>();

        list1.add("Hello");
        list2.add("Hello");

        System.out.println(list1.get(0));
        System.out.println(list2.get(0));
    }
}

What I'm asking here what is the difference between List and ArrayList and why can I instantiate a List as an ArrayList? To me it looks like they do exactly the same.

I hope someone can ELI5 that to me.

Top answer
1 of 4
45
Bad analogy: Using List is like saying "could you pick up peanut butter from the store?" Using ArrayList is like saying "could you pick up some Skippy®™ in the 16oz size from the store?" List is an interface. It can be used to refer to any class that implements the given set of methods and behaviors. ArrayList is a specific implementation of that interface that is backed by an array. You don't necessarily need to use an array to implement the interface, you could use a linked list (i.e. LinkedList.) For example, if some method takes List as a parameter type then it's saying "I don't care what kind, as long as it's got the basic properties of a list." If a method takes ArrayList then it's hinting that there is no such flexibility, and it must be this particular implementation of a list. And you can't instantiate List. Your example is not doing that. In both cases you are instantiating ArrayList. That's the type that is used with new. The type of the reference does not have to be the same as the type of the referent. You are creating two references of different types, but they both refer to objects of type ArrayList.
2 of 4
3
If you've ever wondered what the phrase "programming through interfaces" means, this is why. Basically, List is an interface. ArrayList is one of several implementations of the List interface, with each implementation specializing in some special behavior. ArrayList is the default implementation with the most common behaviors you'd expect of a list. The reason List list1 = new ArrayList(); is better than ArrayList list2 = new ArrayList(); is because an interface is on the left side of the equation. Recall that the left side of the equation is the declaration and the right side is the value you are assigning to that declaration. Thus, the former allows you to switch out the implementation to something else, for example: List list1 = new LinkedList(); The reason this is important isn't easy to see here because this example is very simple. If you project this example into a large application with hundreds of classes, each with dozens of methods and each method requiring specific types of data to do its work; standardizing that data becomes important. We achieve that standardization through the use of interfaces.