HashMap keys to sorted List
You can use the new utilities in the comparator class. Unfortunately you'll have to help the compiler a bit with the generic type induction.

Assuming, that the value class is "Whatever", this can be done like this:

    map.entrySet().stream()
        .sorted(Comparator.comparing((Map.Entry&lt;String, Whatever&gt; e) -&gt; e.getValue().hasPriority())
                          .thenComparing(Map.Entry::getKey))
        .map(Map.Entry::getKey)
        .collect(Collectors.toList());