Iterator do not have method to get next directly without moving cursor

Iterator do not have method to get next directly without moving cursor

Answer : Because object store in the memory has reference address and to get value of any object you need to provide information to java. getNext() could have written but according to java API cursor always point to middle and calling next() will move it to the current position.

Leave a Reply

Your email address will not be published. Required fields are marked *