This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes  java collection problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark " java collection problem" Watch " java collection problem" New topic

java collection problem

manish gupta
Ranch Hand

Joined: Nov 06, 2005
Posts: 36

I have a problem to get the one object from the collection of two objects.
object what I want from collection should be higher value (one of the attribute of my object) from other object in same collection.

I would be appreciate you if help me to resolve this problem.

Thanks in advance
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 38064
Try the Collections.sort() method. Then you get the contents of the collection in order, I think smallest first. The sort method requires you to implement the Comparable<T> interface on your objects, or to create a class from the Comparator<T> interface.
jQuery in Action, 2nd edition
subject: java collection problem
Similar Threads
Collection of Collections
Garbage Collection in Java
how to remove object of perticular class from ArrayList..?
How can i do Runtime Casting
How to get filter object from Collection