[Minor] Code cleanup
This commit is contained in:
parent
eacec9a9ac
commit
b0787891f9
|
@ -15,8 +15,10 @@
|
||||||
*/
|
*/
|
||||||
package li.strolch.model;
|
package li.strolch.model;
|
||||||
|
|
||||||
|
import static java.util.stream.Collectors.joining;
|
||||||
|
import static java.util.stream.Collectors.toSet;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import li.strolch.exception.StrolchException;
|
import li.strolch.exception.StrolchException;
|
||||||
import li.strolch.model.activity.Activity;
|
import li.strolch.model.activity.Activity;
|
||||||
|
@ -245,7 +247,7 @@ public enum State {
|
||||||
|
|
||||||
public static State getState(Activity activity) {
|
public static State getState(Activity activity) {
|
||||||
|
|
||||||
Set<State> states = activity.elementStream().map(e -> e.getValue().getState()).collect(Collectors.toSet());
|
Set<State> states = activity.elementStream().map(e -> e.getValue().getState()).collect(toSet());
|
||||||
|
|
||||||
// if only one state
|
// if only one state
|
||||||
if (states.size() == 1)
|
if (states.size() == 1)
|
||||||
|
@ -288,7 +290,7 @@ public enum State {
|
||||||
return CREATED;
|
return CREATED;
|
||||||
|
|
||||||
// should never happen, unless new state is introduced
|
// should never happen, unless new state is introduced
|
||||||
throw new IllegalStateException("Unhandled situation with states: " + states.stream().map(e -> e.state)
|
throw new IllegalStateException(
|
||||||
.collect(Collectors.joining(", ")));
|
"Unhandled situation with states: " + states.stream().map(e -> e.state).collect(joining(", ")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue