File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Hi can anybody suggest Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Hi can anybody suggest" Watch "Hi can anybody suggest" New topic

Hi can anybody suggest

maha devan
Ranch Hand

Joined: Mar 16, 2004
Posts: 50
Hi people

I am having many sets of values(X,Y Coordinate values)

10, 20

I need to compare all(sets) coordinate values and find the value which is smallest.
In this case Answer is 10,15.
Can anybody suggest an efficient logic

WarnerJan Veldhuis

Joined: Sep 27, 2002
Posts: 9
You could play with the Comparable interface, and use that to let it sort...

For the sake of speed, I made public members For total correctness you would have to override the equals() and the hashcode() methods...

maha devan
Ranch Hand

Joined: Mar 16, 2004
Posts: 50
Hi need some more clarification I have code Like this

class Mahesh

public Point Foo() // This function returns minimum coord as point object
Hashtable hashobj; //This contains the values as key value pairs



I need to implement this functionality inside this function where I have all datas in a Hashtable . How to use comparator over here

I agree. Here's the link:
subject: Hi can anybody suggest
It's not a secret anymore!