A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
getting the values from arraylist
Joined: Aug 12, 2008
Apr 20, 2009 07:36:05
if you can store 100,000 elements(or values) in arraylist ,How to get(or iterate) particular element(or value) from arraylist? and consider the performance issue .
Joined: Aug 03, 2008
Apr 20, 2009 07:55:08
Raj, it is not "lackh", it is lakh i.e. hundred thousand.
Now you said, that you want to iterate over some particular elements. What is the criteria that you have for selecting the elements??
SCJP 6 | SCWCD 5 |
Javaranch SCJP FAQ
Joined: Jan 17, 2006
Apr 20, 2009 09:18:09
is sorted, then you can us a binarySearch. With 100,000 elements, it will take a maximum of 17 comparisons.
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Joined: Oct 14, 2005
Apr 20, 2009 11:09:35
And if there is a serious performance issue here, then perhaps the decision to use an
should be revisited. Using a Set makes the search an O(1) operation, instead of O(N) for an unsorted list and O(log N) for a sorted list.
I agree. Here's the link:
subject: getting the values from arraylist
How to print values
Result set / Arraylist
getting unique values from an arraylist
validating the arraylist values in struts
iterate problem in struts2
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013