Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
package jp.co.confrage;
import java.util.Arrays;
import java.util.stream.Collectors;
public class EnumSample {
public static void main(String[] args) {
var ret =
Arrays.stream(Week.values())
.map(
e -> {
return e.name();
})
.collect(Collectors.toMap(k -> k, v -> v));
System.out.println(ret); // {Monday=Monday, Tursday=Tursday, Friday=Friday, Sunday=Sunday, Wednesday=Wednesday, Tuesday=Tuesday, Saturday=Saturday}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment