public static Map < String , String > sort ( Map < String , String > map ) { Preconditions . checkNotNull ( map , "Cannot sort a null object." ) ; Map < String , String > sorted = new LinkedHashMap < String , String > ( ) ; for ( String key : getSortedKeys ( map ) ) { sorted . put ( key , map . get ( key ) ) ; } return sorted ; }
Sorts a Map