You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2020/02/01 07:38:09 UTC
[dubbo] branch master updated: enhance the java doc of dubbo-common
module. (#5572)
This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 5e85623 enhance the java doc of dubbo-common module. (#5572)
5e85623 is described below
commit 5e85623c976102d79ab8253350f882a3d053c562
Author: withthewind <wi...@aliyun.com>
AuthorDate: Sat Feb 1 15:37:58 2020 +0800
enhance the java doc of dubbo-common module. (#5572)
fixes #2992
---
.../apache/dubbo/common/utils/CollectionUtils.java | 35 ++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/CollectionUtils.java b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/CollectionUtils.java
index 28e9821..9bb3c5e 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/CollectionUtils.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/CollectionUtils.java
@@ -30,6 +30,13 @@ import static java.util.Arrays.asList;
import static java.util.Collections.emptySet;
import static java.util.Collections.unmodifiableSet;
+/**
+ * Miscellaneous collection utility methods.
+ * Mainly for internal use within the framework.
+ *
+ * @author william.liangf
+ * @since 2.0.7
+ */
public class CollectionUtils {
private static final Comparator<String> SIMPLE_NAME_COMPARATOR = new Comparator<String>() {
@@ -211,18 +218,46 @@ public class CollectionUtils {
return ret;
}
+ /**
+ * Return {@code true} if the supplied Collection is {@code null} or empty.
+ * Otherwise, return {@code false}.
+ *
+ * @param collection the Collection to check
+ * @return whether the given Collection is empty
+ */
public static boolean isEmpty(Collection<?> collection) {
return collection == null || collection.isEmpty();
}
+ /**
+ * Return {@code true} if the supplied Collection is {@code not null} or not empty.
+ * Otherwise, return {@code false}.
+ *
+ * @param collection the Collection to check
+ * @return whether the given Collection is not empty
+ */
public static boolean isNotEmpty(Collection<?> collection) {
return !isEmpty(collection);
}
+ /**
+ * Return {@code true} if the supplied Map is {@code null} or empty.
+ * Otherwise, return {@code false}.
+ *
+ * @param map the Map to check
+ * @return whether the given Map is empty
+ */
public static boolean isEmptyMap(Map map) {
return map == null || map.size() == 0;
}
+ /**
+ * Return {@code true} if the supplied Map is {@code not null} or not empty.
+ * Otherwise, return {@code false}.
+ *
+ * @param map the Map to check
+ * @return whether the given Map is not empty
+ */
public static boolean isNotEmptyMap(Map map) {
return !isEmptyMap(map);
}