I have a list of objects, each object has a method that returns distance from player to said object like that
object.distance(player)
now i need to sort that list from loqwest distance to furthest
You can use interface java.lang.Comparable in java
Example (pseudo code) assuming object.distance(player) returns an Integer value
class Distance implements Comparable<Distance>{
  /**
    * Compare a given Distance with this object.
    */
    public int compareTo(Distance o) {
        return this.distance(player).compareTo(o.distance(o.player));
    }
}
now you can sort your list like
Collections.sort(YourListOfDistance)
here some reference
Listof some object, I'm not sure where theplayeris coming from.