Problem How to convert Enum to List of String in Java 8? Solution Using the Java 8 Streams, its map and collect functions we can convert Enum to List of Strings Code import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; public class EnumToStringList { public enum Alpha { A,B,C,D; } public static void main(String[] args) { List<String> strings = Stream.of(Alpha.values()).map( Alpha::name).collect( Collectors.toList()); } }
Blog about programming