Thanks a lot for the information. Could you be more specific? Say for example, I'd like to sort by age. How would you proceed?
Main Topics
Browse All TopicsI'm trying to write a sort method in java that can sort 1d arrays of arbitrary objects. Even though the java library contains such a capability, I'd like to use interface to accomplish the same thing. I did quite some research but figured there's no way to do so without using the Comparable or Comparator interfaces. The concept of function pointers comes to mind but Java does not support them. Could you help me out? Any examples would help. Thanks.
I found the following very helpful:
http://www.docjar.com/html
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Initially take all the objects into an Arrary or vector. Traverse through each and every object and insert them into Linked List Object based on your sort criteria. If sort criteria is Age then compare age of each object from Array List with each object in LinkedListand insert your object in appropriate position of Linked List.
You can use ArraryList object to insert in the middle of the arry list instead of using Linked List.
Regards,
Amar
Business Accounts
Answer for Membership
by: a_bPosted on 2009-11-05 at 20:45:27ID: 25756665
"sort 1d arrays of arbitrary objects". The issue is that you need to specify the field on which you need to sort the object. For eg a class Person - maybe contain fields first name, last name, age etc. Which field will you sort by?
Brute force can always be applied, even though not recommended.