top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Java: If an ArrayList has to be iterate to read data only, what is the fastest way?

+2 votes
527 views
Java: If an ArrayList has to be iterate to read data only, what is the fastest way?
posted Sep 21, 2013 by Vinay Shukla

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
What is the meaning of iterate, what is your doubt and what you have already tried.

1 Answer

0 votes

This can be done in two ways, using for loop or using iterator of ArrayList,use of for loop is faster than using iterator bcoz value stored in arraylist is indexed access. So while accessing the value is accessed directly as per the index.

answer Sep 22, 2013 by Arvind Singh
...