Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
AbstractSequentialList in Java
The Java Collection Framework contains the AbstractSequentialList class. This class is used to create and implement an unmodifiable list. Also this class implements the Collection interface and the AbstractCollection class.
A program that demonstrates this is given as follows −
Example
import java.util.*;
public class Demo {
public static void main(String[] args) {
AbstractSequentialList<String> list = new LinkedList<>();
list.add("John");
list.add("Martha");
list.add("Sally");
list.add("Susan");
list.add("Harry");
System.out.println("The elements are: " + list);
}
}
The output of the above program is as follows −
Output
The elements are: [John, Martha, Sally, Susan, Harry]
Now let us understand the above program.
The AbstractSequentialList class implements an unmodifiable list. The list elements are displayed. A code snippet that demonstrates this is given as follows −
AbstractSequentialList<String> list = new LinkedList<>();
list.add("John");
list.add("Martha");
list.add("Sally");
list.add("Susan");
list.add("Harry");
System.out.println("The elements are: " + list); Advertisements
