Java Map Sort sortedKeys(Map map)

Here you can find the source of sortedKeys(Map map)

Description

Returns the keys for the map in a set sorted alphabetically.

License

Apache License

Parameter

Parameter Description
map The map to get the keys for.

Return

The keys sorted alphabetically.

Declaration

public static SortedSet<String> sortedKeys(Map<String, String> map) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {
    /**//from  w  w w  .  j a  v a2  s .c  o  m
     * Returns the keys for the map in a set sorted alphabetically.
     * <p/>
     * This is used to help build the signature.
     *
     * @param map The map to get the keys for.
     * @return The keys sorted alphabetically.
     */
    public static SortedSet<String> sortedKeys(Map<String, String> map) {
        return new TreeSet<String>(map.keySet());
    }
}

Related

  1. sortByValues(Map map)
  2. sortByValuesDesc(final Map map)
  3. sortClustersKeys(final Map> clusters)
  4. sortDoubleMap(Map map)
  5. sortedByRankThenLength(Map map)
  6. sortedMap(Map map, Comparator comparator)
  7. sortedString(Map c)
  8. sortedString(Map c)
  9. sortedTable(Map map)