Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7058971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:10:35+00:00 2026-05-28T04:10:35+00:00

I am not clear on a point in the documentation of List . It

  • 0

I am not clear on a point in the documentation of List.

It says:

i) Note that these operations may execute in time proportional to the
index value for some implementations (the LinkedList class, for
example).
ii) Thus, iterating over the elements in a list is typically
preferable to indexing through it if the caller does not know the
implementation.

Note that I put the (i) and (ii) in the quote.

Point (i) is pretty obvious due to the way we access a linked list vs the random access of an array.

I can not understand point (ii) though.
What do we gain by prefering an iterator if we don’t know the implementation?
I mean if the implementation is a LinkedList is there any difference in the performance than accessing via the index?
I imagine not, since the Iterator would be manipulating a LinkedList anyway.
So there would be no difference.

So what is the meaning of the recommendation of (ii) in the doc?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:10:36+00:00Added an answer on May 28, 2026 at 4:10 am

    The iterator of a linked list can just have a pointer to the next node in the list, and go to the next node each time next() is called. It doesn’t start from the beginning every time. Whereas if you use an index and call get(i), the linked list has to iterate from the beginning until the ith element at each iteration.

    What you missed is that the iterator implementation of an ArrayList and the one of a LinkedList are completely different.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The Java documentation is not clear on this point. What happens if you call
Unlike other unsafe* operations, the documentation for unsafeInterleaveIO is not very clear about its
Can anyone point me to some documentation that makes clear that a 'Future.get` with
I am not clear on the actual difference between these two styles of class
I am not clear from the documentation - when I indicate a cell width
I have been reading thru the documentation however it is not immediatly clear to
Not clear on some fundamental syntax here. define-key accepts a set of inputs, one
It's not clear, to me anyway, if a UIView is automatically released from its
It's not clear to me if the Eclipse plugin completely replaces the need to
I'm not clear on the status of XHTML - v1.0 versus v1.1. Can someone

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.