set method in listiterator in java

Solutions on MaxInterview for set method in listiterator in java by the best coders in the world

showing results for - "set method in listiterator in java"
Henry
29 Jan 2018
1import java.util.ArrayList;
2import java.util.ListIterator;
3
4public class Main {
5
6
7    public static void main(String[] args) {
8        ArrayList days = new ArrayList<>();
9
10        days.add("Sun");
11        days.add("Mon");
12        days.add("Tue");
13        days.add("Thu");
14        days.add("Fri");
15        days.add("Sat");
16
17        ListIterator iterator = days.listIterator();
18
19        while (iterator.hasNext()) {
20            System.out.println(iterator.next());
21        }
22
23        iterator.set("None");
24
25        System.out.println("After set : ");
26
27        for (String item : days) {
28            System.out.println(item);
29        }
30    }
31
32}