diff --git a/pom.xml b/pom.xml index 47d244b..5f2a600 100644 --- a/pom.xml +++ b/pom.xml @@ -45,6 +45,8 @@ true + + ch.qos.logback logback-classic diff --git a/src/main/java/xyz/zhouxy/plusone/commons/util/PagingAndSortingQueryParams.java b/src/main/java/xyz/zhouxy/plusone/commons/util/PagingAndSortingQueryParams.java index ab712f6..4f4f5bb 100644 --- a/src/main/java/xyz/zhouxy/plusone/commons/util/PagingAndSortingQueryParams.java +++ b/src/main/java/xyz/zhouxy/plusone/commons/util/PagingAndSortingQueryParams.java @@ -20,7 +20,6 @@ import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.regex.Pattern; import javax.annotation.Nullable; @@ -60,10 +59,9 @@ public class PagingAndSortingQueryParams { public PagingAndSortingQueryParams(Map sortableProperties) { Preconditions.checkArgument(sortableProperties != null && !sortableProperties.isEmpty(), "Sortable properties can not be empty."); - for (Entry p : sortableProperties.entrySet()) { - Preconditions.checkArgument(StringUtils.isNotBlank(p.getKey()) && StringUtils.isNotBlank(p.getValue()), - "Property name must not be blank."); - } + sortableProperties.forEach((k, v) -> + Preconditions.checkArgument(StringUtils.isNotBlank(k) && StringUtils.isNotBlank(v), + "Property name must not be blank.")); this.sortableProperties = ImmutableMap.copyOf(sortableProperties); } diff --git a/src/test/java/xyz/zhouxy/plusone/commons/util/TreeBuilderTests.java b/src/test/java/xyz/zhouxy/plusone/commons/util/TreeBuilderTests.java index 7b7b842..a1f56f6 100644 --- a/src/test/java/xyz/zhouxy/plusone/commons/util/TreeBuilderTests.java +++ b/src/test/java/xyz/zhouxy/plusone/commons/util/TreeBuilderTests.java @@ -124,10 +124,8 @@ class MenuList extends Menu { } static MenuList of(String parentMenuCode, String menuCode, String title, Iterable children, int orderNum) { - MenuList instance = of(parentMenuCode, menuCode, title, orderNum); - for (Menu child : children) { - instance.addChild(child); - } + final MenuList instance = of(parentMenuCode, menuCode, title, orderNum); + children.forEach(instance::addChild); return instance; }