类 CollectionUtils
- java.lang.Object
-
- org.apache.dubbo.common.utils.CollectionUtils
-
public class CollectionUtils extends Object
Miscellaneous collection utility methods. Mainly for internal use within the framework.- 从以下版本开始:
- 2.0.7
- 作者:
- william.liangf
-
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static <T> intaddAll(Collection<T> collection, T... values)Add the multiple values intothe specified collectionstatic booleanequals(Collection<?> one, Collection<?> another)Compares the specified collection with another, the main implementation referencesAbstractSetstatic <T> Tfirst(Collection<T> values)Take the first element from the specified collectionstatic booleanisEmpty(Collection<?> collection)Returntrueif the supplied Collection isnullor empty.static booleanisEmptyMap(Map map)Returntrueif the supplied Map isnullor empty.static booleanisNotEmpty(Collection<?> collection)Returntrueif the supplied Collection isnot nullor not empty.static booleanisNotEmptyMap(Map map)Returntrueif the supplied Map isnot nullor not empty.static Stringjoin(List<String> list, String separator)static List<String>join(Map<String,String> map, String separator)static Map<String,List<String>>joinAll(Map<String,Map<String,String>> map, String separator)static booleanmapEquals(Map<?,?> map1, Map<?,?> map2)static <T> Set<T>ofSet(T... values)Convert to multiple values to beLinkedHashSetstatic intsize(Collection<?> collection)Get the size of the specifiedCollectionstatic <T> List<T>sort(List<T> list)static List<String>sortSimpleName(List<String> list)static Map<String,String>split(List<String> list, String separator)static Map<String,Map<String,String>>splitAll(Map<String,List<String>> list, String separator)static <K,V>
Map<K,V>toMap(Object... pairs)static Map<String,String>toStringMap(String... pairs)
-
-
-
方法详细资料
-
splitAll
public static Map<String,Map<String,String>> splitAll(Map<String,List<String>> list, String separator)
-
joinAll
public static Map<String,List<String>> joinAll(Map<String,Map<String,String>> map, String separator)
-
isEmpty
public static boolean isEmpty(Collection<?> collection)
Returntrueif the supplied Collection isnullor empty. Otherwise, returnfalse.- 参数:
collection- the Collection to check- 返回:
- whether the given Collection is empty
-
isNotEmpty
public static boolean isNotEmpty(Collection<?> collection)
Returntrueif the supplied Collection isnot nullor not empty. Otherwise, returnfalse.- 参数:
collection- the Collection to check- 返回:
- whether the given Collection is not empty
-
isEmptyMap
public static boolean isEmptyMap(Map map)
Returntrueif the supplied Map isnullor empty. Otherwise, returnfalse.- 参数:
map- the Map to check- 返回:
- whether the given Map is empty
-
isNotEmptyMap
public static boolean isNotEmptyMap(Map map)
Returntrueif the supplied Map isnot nullor not empty. Otherwise, returnfalse.- 参数:
map- the Map to check- 返回:
- whether the given Map is not empty
-
ofSet
public static <T> Set<T> ofSet(T... values)
Convert to multiple values to beLinkedHashSet- 类型参数:
T- the type ofvalues- 参数:
values- one or more values- 返回:
- read-only
Set
-
size
public static int size(Collection<?> collection)
Get the size of the specifiedCollection- 参数:
collection- the specifiedCollection- 返回:
- must be positive number
- 从以下版本开始:
- 2.7.6
-
equals
public static boolean equals(Collection<?> one, Collection<?> another)
Compares the specified collection with another, the main implementation referencesAbstractSet- 参数:
one-Collectionanother-Collection- 返回:
- if equals, return
true, orfalse - 从以下版本开始:
- 2.7.6
-
addAll
public static <T> int addAll(Collection<T> collection, T... values)
Add the multiple values intothe specified collection- 类型参数:
T- the type of values- 参数:
collection-the specified collectionvalues- the multiple values- 返回:
- the effected count after added
- 从以下版本开始:
- 2.7.6
-
first
public static <T> T first(Collection<T> values)
Take the first element from the specified collection- 类型参数:
T- the type of element of collection- 参数:
values- the collection object- 返回:
- if found, return the first one, or
null - 从以下版本开始:
- 2.7.6
-
-