Code: Select all
public interface System {
public String getConfigKey();
}
Code: Select all
public enum SystemA implements System {
ABC_CONFIG("ABC");
private SystemA(String configKey) {
this.configKey = configKey;
}
private String configKey;
public String getConfigKey() {
return configKey;
}
}
public enum SystemB implements System {
DEF_CONFIG("DEF");
private SystemB(String configKey) {
this.configKey = configKey;
}
private String configKey;
public String getConfigKey() {
return configKey;
}
}
Code: Select all
Set configKeys = Stream.of(SystemA.values(),
SystemB.values()).forEach(config -> config.getConfigKey()).collect(toSet());
Also habe ich es mit der folgenden Änderung versucht: -
Code: Select all
Set configKeys = Stream.of(SystemA.values(),
SystemB.values()).forEach(config -> config.getConfigKey()).collect(toSet());
Kann mir bitte jemand helfen, wie kann ich Änderungen vornehmen? der forEach-Teil? Oder wie kann ich map()/ verwenden?
Code: Select all
flatmap()