listiterator Questions

3

Solved

I m new to Java Collections and my doubt is why can't i traverse a element in linkedlist in backward directions.Below I'll explain what i did and please clarify my doubts. I've created interface ...
Americaamerican asked 13/9, 2015 at 5:26

4

Solved

Iterator ite = Set.iterator(); Iterator ite = List.iterator(); ListIterator listite = List.listIterator(); We can use Iterator to traverse a Set or a List or a Map. But ListIterator can only be ...
Newsreel asked 11/6, 2012 at 10:2

6

package wrap; import java.util.*; public class ArrayListDemo { public static void main(String [] args){ ArrayList<String> a=new ArrayList<String>(); a.add("B"); a.add("C"); a.add(...
Atween asked 28/10, 2013 at 9:56

2

Solved

I know we can use advance() function to increment the iterator. We also use iterator++ to increase the iterator by one position. Why we cannot use it+=2? int main() { list<int> l1{1, 2, 3, ...
Eggers asked 26/10, 2018 at 6:12

4

Solved

Say I have a very large list of integers that occupies a very large amount of memory. If the list's integers were in even increments, I could then easily express the list as an iterator occupying c...
Guest asked 29/4, 2017 at 2:10

8

Solved

ArrayList<String> list = new ArrayList<String>(); list.add("test"); while(list.listIterator().hasNext()) { System.out.println(list.listIterator().next()); } This generates an endles...
Fortran asked 18/5, 2016 at 11:34

5

Solved

I have a list that contains roughly 200K elements. Am I able to pass the iterator for this list to multiple threads and have them iterate over the whole lot, without any of them accessing the same...
Andradite asked 5/2, 2016 at 11:4

1

Solved

Is it safe to add items to a LinkedList while iterating? class Worker { final LinkedList<Foo> worklist = new LinkedList<>(); public void work() { Iterator<Foo> iterator = w...
Largehearted asked 6/10, 2015 at 12:44

2

Solved

I am working with selenium and I am using the function FindElements so I am getting a element that implements IReadOnlyCollection interface. I want to iterate through the list but it seems that IRe...
Stimson asked 17/9, 2015 at 19:44

1

Solved

Lets have a look at this example: public class ListIteratorTest { public static void main(String[] args) { List<String> list = new ArrayList<>(); list.add("element1"); list.add("el...
Bisayas asked 23/3, 2015 at 12:42

1

Solved

I am new to go language. I would like to remove elements from the list while iterating the list based on a condition in go language. For example I want remove the duplicate elements from the list. ...
Cawley asked 26/12, 2014 at 22:30

2

Solved

Although the documentation specifically states that both LinkedHashMap and LinkedHashSet maintains a doubly-linked list running through all of its entries I don't understand why these impleme...
Whorish asked 9/10, 2014 at 11:17

3

Solved

I am trying to use for in to iterate a TObjectList: program Project1; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, Contnrs; var list: TObjectlist; o: TObject; begin list := TObjectL...
Wera asked 29/9, 2014 at 14:59

3

Solved

I am reading the differrences between ArrayList and LinkedList pointed out in When to use LinkedList over ArrayList?. I developed a small example applcation to test a major advantage of LinkedList ...
Perspex asked 5/10, 2013 at 14:32

1

Solved

If I have a std::vector<int>, I can obtain the index of the minimum element by subtracting two iterators: int min_index = std::min_element(vec.begin(), vec.end()) - vec.begin(); However, w...
Sepulture asked 13/3, 2012 at 16:23

3

Solved

Possible Duplicate: Java: adding elements to a collection during iteration My problem is that I want to expand a list with new elements while iterating over it and I want the iterator...
Substitute asked 13/9, 2011 at 23:36
1

© 2022 - 2024 — McMap. All rights reserved.