question: public ArrayList < OUTTYPE > sort ( HashMap < T , Double > input ) { ArrayList < Entry < T , Double > > entries = new ArrayList < Entry < T , Double > > ( input . entrySet ( ) ) ; Collections . sort ( entries , comparator ) ; ArrayList < OUTTYPE > result = new ArrayList < OUTTYPE > ( entries . size ( ) ) ; for ( Entry < T , Double > entry : entries ) result . add ( entry . getKey ( ) ) ; return result ; }
target:  Takes an element-distance map and returns the elements ordered by distance 