Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

What is the complexity of List.subList()?

lordericoOct 8 2009 — edited Oct 8 2009
I realize that the complexity of List.subList() probably varies, so is there a complexity for subList() when using a LinkedList and and ArrayList? From the description in Abstract set, It sounds like subList() returns the same list, except with some special bounds checking/incrementing. If so, that would mean calling subList() is O(1), right? And if that is true, is the sub-list slowed down at all because of this checking? I don't think that would factor into the complexity, though...

Similarly, Is there a one-stop shop for finding complexities of standard java methods? It doesn't appear that the api mentions complexity for every method.

Thanks,

Eric
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 5 2009
Added on Oct 8 2009
1 comment
2,014 views