This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Java in General and the fly likes Sublisting large list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Sublisting large list" Watch "Sublisting large list" New topic

Sublisting large list

chets patel
Ranch Hand

Joined: Apr 27, 2010
Posts: 77

Hi All,
I have a list of having more than 2000 records. I want to get sublist of the same. But it is very slow. Is there any other way I can get the sublist of the large list.
Please help.

Thanks in advance.
Roberto Perillo

Joined: Dec 28, 2007
Posts: 2269

Please TellTheDetails. Is this list ordered already? What are these "records"? Are these objects too complex? What is the filter for this sublist?

Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 41094
2000 is not a large list. It should take a few μs to get a sublist.
Rob Spoor

Joined: Oct 27, 2005
Posts: 19908

Please show us how you create this sub list. If that's slow then perhaps you're doing it in a less efficient way.

How To Ask Questions How To Answer Questions
Jeff Verdegan

Joined: Jan 03, 2004
Posts: 6109

chets patel wrote:Is there any other way I can get the sublist of the large list.

There are many ways. If the way you're using is to slow, then you should use a different way.
It is sorta covered in the JavaRanch Style Guide.
subject: Sublisting large list