У меня есть класс Enum, как это: < /p>
public enum Severity {
HIGH("High level it is ", RED, DARK_RED),
MEDIUM("Medium level it is ", AMBER, LIGHT_YELLOW),
LOW("Low level it is ", GREEN, DARK_GREEN);
private String value;
private List color;
Severity(String value, Color... colors) {
this.value = value;
this.color = Arrays.asList(colors);
}
public static List getSeverityKeys() {
return EnumSet.allOf(Severity.class).stream()
.map(Severity::name)
.collect(Collectors.toList());
}
public static List getSeverityValues() {
return EnumSet.allOf(Severity.class).stream()
.map(Severity::getValue)
.collect(Collectors.toList());
}
public static Severity getDescriptionByColor(String color) {
return EnumSet.allOf(Severity.class).stream()
.filter(severity -> Severity.getToolDomainValues().equals(color))
.findFirst()
.orElse(null);
}
public String getValue() {
return value;
}
public List getColor() {
return color;
}
}
< /code>
input: dark_red < /p>
< /blockquote>
Выход: Высокий уровень. /> < /blockquote>
Выход: Низкий уровень. Это < /p>
< /blockquote>
Как я могу достичь этого с помощью функциональности потока Java < /p>
Я пытаюсь исправить метод>
Подробнее здесь: https://stackoverflow.com/questions/613 ... m-a-string