Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Why ListIterator has add() method but Iterator does not have?

Pragya Keshap answered on February 4, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers


Why ListIterator has add() method but Iterator does not have?

0

ListIterator can iterate in the both directions of a Collection. It

maintains two pointer for previous and next element. In ListIterator

we can use add() method to add an element into the list immediately

before the element returned by next() method.

So a subsequent call to next() method will not be affected. And the

call to previous() method will return the newly added element.

In Iterator we can only traverse in one direction. So there is no

purpose of add() method there

https://fayllar.org/how-remove-method-is-implemented-in-a-hashmap.html?page=8

Popularity 1/10 Helpfulness 1/10 Language whatever
Source: Grepper
Link to this answer
Share Copy Link
Contributed on Feb 04 2023
Pragya Keshap
0 Answers  Avg Quality 2/10


X

Continue with Google

By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
X
Grepper Account Login Required

Oops, You will need to install Grepper and log-in to perform this action.