I need to solve this kind of problem :
I hava a list of many objects, each object has his own [x][y], and I need to find the closest object to object A from objects class B.
I know this is maybe a bad explanation but I am doing my best.
Pseudo Code :
List<Object> myList
myList.add(new C) x,y not important
myList.add(new B)
myList.add(new C) x,y not important
myList.add(new A)
myList.add(new C) x,y not important
myList.add(new B)
myList.add(new A)
myList.add(new C) x,y not important
myList.add(new E) x,y not important
myList.add(new E) x,y not important
myList.add(new A)
...
The result of searching should be something like this :
A x,y is the closest to B x,y
A x,y is the closest to B x,y
A x,y is the closest to B x,y
The second thing I need to do is to generate path to do the closest ones.
I don't ask you to 'ready code' just maybe a little advice, some articular ...
My first idea was to create a new List witch will contain only Objects A, after that maybe sort it, and later find somehow the closest one, but I don't know how.
If you have any idea please help, Thank you very much!