No, you rarely need to use linked list. The reason is that due the cpu caching functionality arraylist almost always outperforms a linked list. If you need any special type (like queue) java has a type for that. https://stackoverflow.com/questions/322715/when-to-use-linkedlist-over-arraylist-in-java Answer from redikarus99 on reddit.com
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › util › LinkedList.html
LinkedList (Java Platform SE 8 )
3 weeks ago - Java™ Platform Standard Ed. 8 ... public class LinkedList<E> extends AbstractSequentialList<E> implements List<E>, Deque<E>, Cloneable, Serializable
🌐
W3Schools
w3schools.com › java › java_linkedlist.asp
Java LinkedList
For many cases, the ArrayList is more efficient as it is common to need access to random elements in the list, but the LinkedList provides several methods to do certain operations more efficiently: From Java 10, you can use the var keyword to declare a LinkedList variable without writing the type twice.
Discussions

Have you ever used a LinkedList implementation on the job?
No, you rarely need to use linked list. The reason is that due the cpu caching functionality arraylist almost always outperforms a linked list. If you need any special type (like queue) java has a type for that. https://stackoverflow.com/questions/322715/when-to-use-linkedlist-over-arraylist-in-java More on reddit.com
🌐 r/java
120
133
April 10, 2022
Useless linked list in Java?
The point is to learn the structure and to learn programming. In real life, you will hardly ever have to implement your own data structures. More on reddit.com
🌐 r/learnprogramming
28
45
August 14, 2024
🌐
Android Developers
developer.android.com › api reference › linkedlist
LinkedList | API reference | Android Developers
Skip to main content · English · Deutsch · Español – América Latina · Français · Indonesia · Polski · Português – Brasil · Tiếng Việt · 中文 – 简体
🌐
Reddit
reddit.com › r/java › have you ever used a linkedlist implementation on the job?
r/java on Reddit: Have you ever used a LinkedList implementation on the job?
April 10, 2022 -

I have been working as a swe for 1 year now, mostly with Java and Spring framework. And not once have I implemented or seen an implementation of a LinkedList on the codebase. I was wondering, what are some real use cases you have seen with LinkedLists?

🌐
Hackajob
hackajob.com › talent › blog › implementing-linked-lists-in-java
How to Implement Linked Lists in Java
November 5, 2025 - You've now seen what a linked list is, how to implement one in Java and do some of the basic operations like adding and deleting a node. Several other operations can be done on linked lists like adding nodes at specified positions, deleting from specified positions, checking for loops, finding the merge points, etc.
🌐
GeeksforGeeks
geeksforgeeks.org › java › linked-list-in-java
LinkedList in Java - GeeksforGeeks
LinkedList is a part of the Java Collections Framework and is present in the java.util package.
Published   3 weeks ago
Find elsewhere
🌐
DataCamp
datacamp.com › doc › java › linkedlist
Java LinkedList
LinkedList is used when frequent insertions and deletions are required. It is particularly useful when the size of the list is not known in advance or when elements need to be added or removed at both ends of the list. ... Type: The type of elements stored in the list.
🌐
Coding Shuttle
codingshuttle.com › java-programming-handbook › java-linked-list
Java LinkedList | Coding Shuttle
April 9, 2025 - Java Fundamentals Interview ... Questions ... The LinkedList class in Java is part of the Java Collections Framework and implements both the List and Deque interfaces....
🌐
Reddit
reddit.com › r/learnprogramming › useless linked list in java?
r/learnprogramming on Reddit: Useless linked list in Java?
August 14, 2024 -

Hey, so I'm currently in my second semester of comp sci and learning Java. Right now they have me making my own list(singly linked list) class which is only capable of holding one type of object. Will it ever be practical to make my own linked list in java, because from my understanding java.util.LinkedList is just a doubly linked list? Or am I coding this to understand the concept?

🌐
Codecademy
codecademy.com › docs › java › linkedlist
Java | LinkedList | Codecademy
October 15, 2025 - In Java, a LinkedList is a doubly linked list implementation in java.util that implements List<E>, Deque<E>, Cloneable, and Serializable. Elements are stored in nodes linked to previous and next nodes.
🌐
Medium
medium.com › @hrutiksurwade › understanding-java-linkedlist-a-deep-dive-ba16fa054d8b
Understanding Java LinkedList: A Deep Dive | by Hrutik Surwade | Medium
March 24, 2025 - Java’s LinkedList is a fundamental data structure that offers efficient insertions and deletions. Unlike arrays, which require shifting elements during modifications, a LinkedList provides a dynamic structure where elements are linked together, ...
🌐
DigitalOcean
digitalocean.com › community › tutorials › java-linkedlist-linkedlist-java
Java LinkedList - LinkedList In Java | DigitalOcean
August 4, 2022 - Java LinkedList is an implementation of the List and Deque interfaces. It is one of the frequently used List implementation class. It extends AbstractSequentialList and implements List and Deque interfaces. It is an ordered collection and supports duplicate elements.
🌐
W3Schools
w3schools.com › java › java_ref_linkedlist.asp
Java LinkedList Reference
Some methods use the type of the LinkedList'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
🌐
CodeGym
codegym.cc › java blog › java collections › linked list data structure in java
Linked List Data Structure in Java
January 14, 2025 - LinkedList is a data structure, a part of the Java 8 Collection. how to work with LinkList, how to reverse LinkedList, LinkedList benefits over ArrayList
Top answer
1 of 10
48

If you're actually building a real system, then yes, you'd typically just use the stuff in the standard library if what you need is available there. That said, don't think of this as a pointless exercise. It's good to understand how things work, and understanding linked lists is an important step towards understanding more complex data structures, many of which don't exist in the standard libraries.

There are some differences between the way you're creating a linked list and the way the Java collections API does it. The Collections API is trying to adhere to a more complicated interface. The Collections API linked list is also a doubly linked list, while you're building a singly linked list. What you're doing is more appropriate for a class assignment.

With your LinkedList class, an instance will always be a list of at least one element. With this kind of setup you'd use null for when you need an empty list.

Think of next as being "the rest of the list". In fact, many similar implementations use the name "tail" instead of "next".

Here's a diagram of a LinkedList containing 3 elements:

Note that it's a LinkedList object pointing to a word ("Hello") and a list of 2 elements. The list of 2 elements has a word ("Stack") and a list of 1 element. That list of 1 element has a word ("Overflow") and an empty list (null). So you can treat next as just another list that happens to be one element shorter.

You may want to add another constructor that just takes a String, and sets next to null. This would be for creating a 1-element list.

To append, you check if next is null. If it is, create a new one element list and set next to that.

next = new LinkedList(word);

If next isn't null, then append to next instead.

next.append(word);

This is the recursive approach, which is the least amount of code. You can turn that into an iterative solution which would be more efficient in Java*, and wouldn't risk a stack overflow with very long lists, but I'm guessing that level of complexity isn't needed for your assignment.


* Some languages have tail call elimination, which is an optimization that lets the language implementation convert "tail calls" (a call to another function as the very last step before returning) into (effectively) a "goto". This makes such code completely avoid using the stack, which makes it safer (you can't overflow the stack if you don't use the stack) and typically more efficient. Scheme is probably the most well known example of a language with this feature.

2 of 10
27

What you have coded is not a LinkedList, at least not one that I recognize. For this assignment, you want to create two classes:

LinkNode
LinkedList

A LinkNode has one member field for the data it contains, and a LinkNode reference to the next LinkNode in the LinkedList. Yes, it's a self referential data structure. A LinkedList just has a special LinkNode reference that refers to the first item in the list.

When you add an item in the LinkedList, you traverse all the LinkNode's until you reach the last one. This LinkNode's next should be null. You then construct a new LinkNode here, set it's value, and add it to the LinkedList.

public class LinkNode { 

    String data;
    LinkNode next;

    public LinkNode(String item) { 

       data = item;

    }

}

public class LinkedList { 

    LinkNode head;

    public LinkedList(String item) { 

       head = new LinkNode(item);

    }

    public void add(String item) { 

       //pseudo code: while next isn't null, walk the list
       //once you reach the end, create a new LinkNode and add the item to it.  Then
       //set the last LinkNode's next to this new LinkNode

    }


}
🌐
Baeldung
baeldung.com › home › java › java list › creating a custom linked list data structure in java
Creating a Custom Linked List Data Structure in Java | Baeldung
April 22, 2025 - Learn how to implement a custom singly linked list in Java with the functionality to insert, remove, retrieve, and count elements.
🌐
Tutorialspoint
tutorialspoint.com › java › java_linkedlist_class.htm
Java - The LinkedList Class
The following program illustrates several of the methods supported by LinkedList − · import java.util.*; public class LinkedListDemo { public static void main(String args[]) { // create a linked list LinkedList ll = new LinkedList(); // add elements to the linked list ll.add("F"); ll.add("B"); ll.add("D"); ll.add("E"); ll.add("C"); ll.addLast("Z"); ll.addFirst("A"); ll.add(1, "A2"); System.out.println("Original contents of ll: " + ll); // remove elements from the linked list ll.remove("F"); ll.remove(2); System.out.println("Contents of ll after deletion: " + ll); // remove first and last elements ll.removeFirst(); ll.removeLast(); System.out.println("ll after deleting first and last: " + ll); // get and set a value Object val = ll.get(2); ll.set(2, (String) val + " Changed"); System.out.println("ll after change: " + ll); } }
🌐
BeginnersBook
beginnersbook.com › 2013 › 12 › linkedlist-in-java-with-example
LinkedList in Java with Example
In the following example we are checking out the few popular remove methods in the LinkedList that are used to remove elements from certain positions in the LinkedList. Detailed explanation of these methods along with examples are covered in the separate tutorials, links are provided at the end of this article. package com.beginnersbook; import java.util.*; public class JavaExample{ public static void main(String args[]){ LinkedList<String> list=new LinkedList<String>(); //Adding elements to the Linked list list.add("Steve"); list.add("Carl"); list.add("Raj"); list.add("Negan"); list.add("Rick
🌐
Study.com
study.com › programming languages › compiled languages › java (programming language) › java data structures
Java Linkedlist Definition, Methods & Examples | Study.com
October 16, 2025 - Unlike arrays that store elements in contiguous memory locations, a LinkedList consists of nodes in which each node contains both data and a reference (or link) to the next node in the sequence.
🌐
TutorialsPoint
tutorialspoint.com › java › util › java_util_linkedlist.htm
Java LinkedList Class
We're adding couple of Integers to the LinkedList object using add() method calls per element and then print each element to show the elements added. package com.tutorialspoint; import java.util.LinkedList; public class LinkedListDemo { public static void main(String[] args) { // create an empty linked list LinkedList<Integer> linkedList = new LinkedList<>(); // use add() method to add elements in the linkedList linkedList.add(20); linkedList.add(30); linkedList.add(20); linkedList.add(30); linkedList.add(15); linkedList.add(22); linkedList.add(11); // let us print all the elements available in linkedList for (Integer number : linkedList) { System.out.println("Number = " + number); } } }