public static String joinKeys ( final Map < String , ? > aMap , final char aSeparator ) { if ( aMap . isEmpty ( ) ) { return "" ; } final Iterator < String > iterator = aMap . keySet ( ) . iterator ( ) ; final StringBuilder buffer = new StringBuilder ( ) ; while ( iterator . hasNext ( ) ) { buffer . append ( iterator . next ( ) ) . append ( aSeparator ) ; } final int length = buffer . length ( ) - 1 ; return buffer . charAt ( length ) == aSeparator ? buffer . substring ( 0 , length ) : buffer . toString ( ) ; }
Turns the keys in a map into a character delimited string . The order is only consistent if the map is sorted .