Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting an array of Objects

Status
Not open for further replies.

blues77

Programmer
Jun 11, 2002
230
CA
Hello,

I was wondering if anyone knew of any Java native API method that would allow me to sort an Array of objects based on a integer instance variable in the objects. For instance, say I had a class called ABC which contained an integer instance variable called x. Each instance of class ABC has a value assigned to x and I want to sort the Array of ABC objects in order based on the value of x. If anyone has any suggests I would appreciate hearing from you.

Thanks
 
Java native API

What do you mean by this exactly ? Do you mean a JNI interface to a C/C++/Assembler method or something else ?

--------------------------------------------------
Free Database Connection Pooling Software
 
I remember having answered this post before.

You need to implement Comparable.

Cheers,

Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top