This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv 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 REST with Spring (video course) this week in the Spring 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: 2270

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: 45359
2000 is not a large list. It should take a few μs to get a sublist.
Rob Spoor

Joined: Oct 27, 2005
Posts: 20193

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.
I agree. Here's the link:
subject: Sublisting large list
It's not a secret anymore!