dir.by  
  Поиск  
Компьютер, программы
Java
Java (class, interface, collections, etc.)
 class LinkedList in Java 
посмотрели 308 раз
обновлено: 25 Augusta 2026
class LinkedList<E>
  implements interface List<E> this list
and
implements interface Deque<E> two-way queue

LinkedList is a list in which each element has 2 links: a link to the next element and a link to the previous element.

In LinkedList can add and remove elements.

In LinkedList any element can be gotten by integer index.

LinkedList is not synchronized. If multiple threads access a LinkedList concurrently, and at least one of the threads modifies the LinkedList, then LinkedList must be synchronized. Usually this is synchronization, it is done like this:
List myList1 = Collections.synchronizedList( new LinkedList(...) );
  Java  
class LinkedList<E> extends AbstractSequentialList<E>   implements List<E>, Deque<E>, Cloneable, Serializable
{
     // Constructors
     LinkedList()    
     LinkedList(Collection<? extends E> c)    

     // Methods
     boolean add(E e)
     void add(int index, E element)
     boolean addAll(Collection<? extends E> c)
     boolean addAll(int index, Collection<? extends E> c)
     void addFirst(E e) // from Deque
     void addLast(E e) // from Deque
     void clear()
     Object clone()
     boolean contains(Object o)
     Iterator<E> descendingIterator() // from Deque
     E element() // from Deque
     E get(int index)
     E getFirst() // from Deque
     E getLast() // from Deque
     int indexOf(Object o)
     int lastIndexOf(Object o)
     ListIterator<E> listIterator(int index)

     boolean offer(E e) // from Deque
     boolean offerFirst(E e) // from Deque
     boolean offerLast(E e) // from Deque
     E peek() // from Deque
     E peekFirst() // from Deque
     E peekLast() // from Deque
     E poll() // from Deque
     E pollFirst() // from Deque
     E pollLast() // from Deque
     E pop() // from Deque
     void push(E e) // from Deque
     E remove() // from Deque
     E remove(int index)
     boolean remove(Object o)
     E removeFirst() // from Deque
     boolean removeFirstOccurrence(Object o) // from Deque
     E removeLast() // from Deque
     boolean removeLastOccurrence(Object o) // from Deque
     E set(int index, E element)
     int size()
     Spliterator<E> spliterator()
     Object[] toArray()
     <T> T[] toArray(T[] a)

     // Methods inherited from class java.util.AbstractSequentialList
     Iterator<E> iterator()

     // Methods inherited from class java.util.AbstractList
     boolean equals(Object o)
     int hashCode()
     ListIterator<E> listIterator(int index)
     void removeRange(int fromIndex, int toIndex)
     List<E> subList(int fromIndex, int toIndex)

     // Methods inherited from class java.util.AbstractCollection
     boolean containsAll(Collection<?> c)
     boolean isEmpty()
     boolean removeAll(Collection<?> c)
     boolean retainAll(Collection<?> c)
     String toString()

     // Methods inherited from class java.lang.Object
     void finalize()
     Class<?> getClass()
     void notify()
     void notifyAll()
     void wait()
     void wait(long timeout)
     void wait(long timeout, int nanos)

     // Methods inherited from interface java.util.List
     boolean containsAll(Collection<?> c)
     boolean equals(Object o)
     int hashCode()
     boolean isEmpty()
     Iterator<E> iterator()
     ListIterator<E> listIterator()
     ListIterator<E> listIterator(int index)
     boolean removeAll(Collection<?> c)
     void replaceAll(UnaryOperator<E> operator)
     boolean retainAll(Collection<?> c)
     void sort(Comparator<? super E> c)
     List<E> subList(int fromIndex, int toIndex)

     // Methods inherited from interface java.util.Deque
     Iterator<E> iterator()

     // Methods inherited from interface java.util.Collection
     Stream<E> parallelStream()
     boolean removeIf(Predicate<? super E> filter)
     Stream<E> stream()

     // Methods inherited from interface java.lang.Iterable
     void forEach(Consumer<? super T> action)
}


Learn more about methods in the Java documentation:https://docs.oracle.com ...
 
← Previous topic
class Vector<E> in Java
 
Next topic →
class HashSet<E> in Java
 
Your feedback ... Comments ...
   
Your Name
Your comment (www links can only be added by a logged-in user)

 
Download and install
Installation JDK (download and install the Java library for Windows)
Download and install IntelliJ IDEA to explore Java, Spring, Jakarta EE | Functionality and differences: Community | Ultimate
Java (class, interface, collections, etc.)
Create a simple console app in IntelliJ IDEA to learn Java
Collections in Java
class ArrayList<E> in Java
class Vector<E> in Java
class LinkedList<E> in Java
class HashSet<E> in Java
class LinkedHashSet<E> in Java
filter() in the List collection (select elements by condition) | Java | Example: allCars.stream().filter(item -> item.Price < 30000).toList()
What is interface in Java ?
Directly in the code (at runtime) we make an implementation for the interface | Java
Threads in Java
lambda is an unnamed method (no name and no class owned) | Java
Exceptions and handling in Java. Example: try {...} catch (Exception e) {...}
Why use throws Exception in the function name in Java? Answer: The method throws an exception and there is no handling of try catch. Example: float CalculateDensity(float mass, float volume) throws Exception { ... throw new Exception("Error! Volume is zero."); ... }
Java web application (servlet, jsp page, basic functionality and no frameworks)
Creating a new simple web application (jsp web page) | Java, Maven
Create a web servlet (the servlet is located on the web server, returns the result on request) | Java
Installation Tomcat web server (download and install for Windows)
Check, test Tomcat web server (create a new my.hml file)
What is Maven
What is a dynamic web page jsp (Java Server Page) ?
How to install Smart Tomcat plugin in Intellij Idea
Error "The SDK is not specified for module ... | Project SDK is not defined ..." in IntelliJ IDEA | Java
Spring in Java (Spring Framework, Spring Data, Spring Boot, ...)
What is Spring? Why use Spring in Java?
What is Spring Bean? What is Spring Container? IoC (inversion of control) | Creating a simple Spring project and configuration Spring Container in an XML file | Editor IntelliJ Idea and language Java
What is Dependency Injection in Spring? Creating a simple Spring project with Dependency Injection in the constructor with the attributes @Component, @Autowired | Editor IntelliJ Idea and language Java
Create a new Spring Web application (the request goes to the Controller → Controller creates a response as text or json) | Java, Spring Web, Spring Boot, Maven
Creating a new Spring WebSocket application (Java WebSocket sends a message to the JavaScript WebSocket) | Java, Spring WebSocket, Spring Boot, Maven
Create Azure Web App with the type Java (free). That is, create an empty web server
Put the Java Spring web application in Azure
Connect to the application Azure Web App (Java) via FTP | use File Explorer
Error "The SDK is not specified for module ... | Project SDK is not defined ..." in IntelliJ IDEA | Java, Spring Boot
How to install Spring WebSocket plugin in Intellij Idea
Jakarta EE / Java EE in Java (Web Applications, Web Services)
What is Jakarta EE (Java EE)? | In which editor (program) is it convenient to write Jakarta EE (Java EE) code?
Creating a simple web project in IntelliJ Idea Ultimate | Jakarta EE (Java EE)
Struts in Java (extends API Java Servlet using MVC)
What is Struts | Java
Courses, training
Course "Java developer" from Yandex
Interview
Interviews on Java

  Ваши вопросы присылайте по почте: info@dir.by