- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
The iterator() method of Java AbstractSequentialList class
The iterator() method of the AbstractSequentialList class iterates over the elements in this list and returns it.
The syntax is as follows
Iterator<E> iterator()
To work with the AbstractSequentialList class in Java, you need to import the following package
import java.util.AbstractSequentialList;
The following is an example to implement AbstractSequentialList iterator() method in Java
Example
import java.util.LinkedList; import java.util.AbstractSequentialList; import java.util.Iterator; public class Demo { public static void main(String[] args) { AbstractSequentialList<Integer> absSequential = new LinkedList<>(); absSequential.add(10); absSequential.add(25); absSequential.add(60); absSequential.add(70); absSequential.add(195); System.out.println("Elements in the AbstractSequentialList = "+absSequential); Iterator<Integer> i = absSequential.iterator(); while (i.hasNext()) { System.out.print(i.next() + " "); } } }
Output
Elements in the AbstractSequentialList = [10, 25, 60, 70, 195] 10 25 60 70 195
- Related Articles
- The listIterator() method of Java AbstractSequentialList class
- The remove() method of Java AbstractSequentialList class
- The get() method of Java AbstractSequentialList class
- The set() method of Java AbstractSequentialList class
- The addAll() method of Java AbstractSequentialList class
- The add() method of Java AbstractSequentialList class
- The iterator() method of Java AbstractCollection class
- The iterator() method of AbstractList class in Java
- The contains() method of AbstractSequentialList in Java
- The clear() method of AbstractSequentialList in Java
- The toArray() method of AbstractSequentialList in Java
- The isEmpty() method of AbstractSequentialList in Java
- The subList() method of AbstractSequentialList in Java
- The equals() method of AbstractSequentialList in Java
- The indexOf() method of AbstractSequentialList in Java

Advertisements