You can do something like this:
Set<String> o = m1.entrySet()
.stream()
.flatMap(e -> Stream.concat(Stream.of(e.getKey()),e.getValue().stream()))
.collect(Collectors.toSet());
i.e. create a Stream<String>
of each entry of the Map
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…