• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hi can anybody suggest

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic