private static < V > Collection < V > sorted ( Iterable < V > source , Comparator < V > comparator , int size ) { V [ ] vs = ( V [ ] ) new Object [ size ] ; int i = 0 ; for ( V v : source ) vs [ i ++ ] = v ; Arrays . sort ( vs , comparator ) ; return Arrays . asList ( vs ) ; }
return a sorted collection