About 247,000 results
Open links in new tab
  1. ListIterator in Java - GeeksforGeeks

    Nov 1, 2022 · In Java, the spliterator() method of the LinkedList class returns a Spliterator that helps iterate over an element of the linked list. A Spliterator is a special type of iterator used to process elements in parallel processing of elements when used with conjunction in …

  2. ListIterator (Java Platform SE 8 ) - Oracle

    An iterator for lists that allows the programmer to traverse the list in either direction, modify the list during iteration, and obtain the iterator's current position in the list.

  3. loops - Ways to iterate over a list in Java - Stack Overflow

    In Java, there are multiple ways to iterate over a List, depending on your use case, Java version, and style preference. Here's a breakdown of the most common methods:

  4. Iterate through List in Java - GeeksforGeeks

    Jun 3, 2024 · Method 3: Using List iterator. ListIterator is an iterator in Java which is available since the 1.2 version. It allows us to iterate elements one-by-one from a List implemented object. It is used to iterator over a list using while loop. Syntax: ListIterator<data_type> variable = list_name.listIterator(); Below is the example of this method: Java

  5. Ways to Iterate Over a List in Java - Baeldung

    Apr 10, 2025 · In this article, we demonstrated the different ways to iterate over the elements of a list using the Java API. These options included the for loop, enhanced for loop, Iterator, ListIterator, and the forEach() method (included in Java 8). Then we learned how to use the forEach() method with Streams.

  6. Java ArrayList listIterator() Method - W3Schools

    The listIterator() method returns a ListIterator for the list. To learn how to use iterators, see our Java Iterator tutorial. The ListIterator differs from an Iterator in that it can also traverse the list backwards.

  7. ArrayList listIterator () Method in Java - GeeksforGeeks

    Dec 13, 2024 · Explanation: In the above example, we use a ListIterator to iterate over an ArrayList of Strings i.e. “A”, “B”, “C”, and “D”. It prints each element of the list sequentially using the hasNext () and next () methods of the ListIterator.

  8. ListIterator in Java - DigitalOcean

    Aug 4, 2022 · In Java, ListIterator is an interface in Collection API. It extends Iterator interface. To support Forward and Backward Direction iteration and CRUD operations, it has the following methods. We can use this Iterator for all List implemented classes like ArrayList, CopyOnWriteArrayList, LinkedList, Stack, Vector, etc.

  9. ListIterator in Java with examples - BeginnersBook

    Sep 11, 2022 · In the last tutorial, we discussed Iterator in Java using which we can traverse a List or Set in forward direction. Here we will discuss ListIterator that allows us to traverse the list in both directions (forward and backward). In this example we are traversing an ArrayList in both the directions. names.add("Shyam"); . names.add("Rajat"); .

  10. Java ListIterator Interface - Programiz

    ListIterator<Integer> iterate = numbers.listIterator(); // Using the next() method int number1 = iterate.next(); System.out.println("Next Element: " + number1); // Using the nextIndex() int index1 = iterate.nextIndex(); System.out.println("Position of Next Element: " + index1); // Using the hasNext() method .

  11. Some results have been removed
Refresh