aspose file tools*
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Hi can anybody suggest" Watch "Hi can anybody suggest" New topic
Author

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
10,15
200,130
10,30
30,30

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

Thanks
WarnerJan Veldhuis
Greenhorn

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

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hi can anybody suggest
 
Similar Threads
Need Suggestion for next Certification
Android: set y-coordinate of textview dynamically
was 7 in eclipse
drawing lines
Maze Solving