Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hi can anybody suggest

 
maha devan
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic