Commit 7d4b5319 authored by liaozan's avatar liaozan 🏀

Polish

parent 56bd4f4e
...@@ -41,7 +41,7 @@ public class TreeUtils { ...@@ -41,7 +41,7 @@ public class TreeUtils {
Function<T, K> parentKeyExtractor, Function<T, K> parentKeyExtractor,
Function<T, E> childMapper, Function<T, E> childMapper,
BiConsumer<E, List<E>> childrenSetter, BiConsumer<E, List<E>> childrenSetter,
Comparator<E> childrenComparator, @Nullable Comparator<E> childrenComparator,
@Nullable K parentId) { @Nullable K parentId) {
if (CollectionUtils.isEmpty(nodes)) { if (CollectionUtils.isEmpty(nodes)) {
return new ArrayList<>(); return new ArrayList<>();
......
...@@ -3,7 +3,10 @@ package com.schbrain.common.enums; ...@@ -3,7 +3,10 @@ package com.schbrain.common.enums;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import java.util.Arrays;
import java.util.Objects; import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
/** /**
* @author huangxi * @author huangxi
...@@ -22,10 +25,20 @@ public enum BooleanEnum { ...@@ -22,10 +25,20 @@ public enum BooleanEnum {
*/ */
FALSE(0); FALSE(0);
private static final Set<Integer> VALUES = Arrays.stream(values()).map(BooleanEnum::getValue).collect(Collectors.toSet());
private final Integer value; private final Integer value;
public static boolean validate(Integer value) { public static boolean validate(Integer value) {
return VALUES.contains(value);
}
public static boolean isTrue(Integer value) {
return Objects.equals(TRUE.value, value); return Objects.equals(TRUE.value, value);
} }
public static boolean isFalse(Integer value) {
return Objects.equals(FALSE.value, value);
}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment