类 CollectionUtils
- java.lang.Object
-
- com.alibaba.nacos.client.naming.utils.CollectionUtils
-
public class CollectionUtils extends java.lang.ObjectProvides utility methods and decorators forCollectioninstances.- 从以下版本开始:
- Commons Collections 1.0
- 版本:
- $Revision: 1713167 $ $Date: 2015-11-07 20:44:03 +0100 (Sat, 07 Nov 2015) $
- 作者:
- Rodney Waldhoff, Paul Jack, Stephen Colebourne, Steve Downey, Herve Quiroz, Peter KoBek, Matthew Hawthorne, Janek Bogucki, Phil Steitz, Steven Melzer, Jon Schewe, Neil O'Toole, Stephen Smith
-
-
字段概要
字段 修饰符和类型 字段 说明 private static java.lang.IntegerINTEGER_ONEConstant to avoid repeated object creation.
-
构造器概要
构造器 构造器 说明 CollectionUtils()CollectionUtilsshould not normally be instantiated.
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static java.util.MapgetCardinalityMap(java.util.Collection coll)Returns aMapmapping each unique element in the givenCollectionto anIntegerrepresenting the number of occurrences of that element in theCollection.private static intgetFreq(java.lang.Object obj, java.util.Map freqMap)static booleanisEmpty(java.util.Collection coll)Null-safe check if the specified collection is empty.static booleanisEqualCollection(java.util.Collection a, java.util.Collection b)Returns true iff the givenCollections contain exactly the same elements with exactly the same cardinalities.static java.util.Collectionsubtract(java.util.Collection a, java.util.Collection b)Returns a newCollectioncontaining a - b.
-
-
-
方法详细资料
-
subtract
public static java.util.Collection subtract(java.util.Collection a, java.util.Collection b)Returns a newCollectioncontaining a - b. The cardinality of each element e in the returnedCollectionwill be the cardinality of e in a minus the cardinality of e in b, or zero, whichever is greater.- 参数:
a- the collection to subtract from, must not be nullb- the collection to subtract, must not be null- 返回:
- a new collection with the results
- 另请参阅:
Collection.removeAll(java.util.Collection<?>)
-
getCardinalityMap
public static java.util.Map getCardinalityMap(java.util.Collection coll)
Returns aMapmapping each unique element in the givenCollectionto anIntegerrepresenting the number of occurrences of that element in theCollection.Only those elements present in the collection will appear as keys in the map.
- 参数:
coll- the collection to get the cardinality map for, must not be null- 返回:
- the populated cardinality map
-
isEqualCollection
public static boolean isEqualCollection(java.util.Collection a, java.util.Collection b)Returns true iff the givenCollections contain exactly the same elements with exactly the same cardinalities.That is, iff the cardinality of e in a is equal to the cardinality of e in b, for each element e in a or b.
- 参数:
a- the first collection, must not be nullb- the second collection, must not be null- 返回:
trueiff the collections contain the same elements with the same cardinalities.
-
isEmpty
public static boolean isEmpty(java.util.Collection coll)
Null-safe check if the specified collection is empty.Null returns true.
- 参数:
coll- the collection to check, may be null- 返回:
- true if empty or null
- 从以下版本开始:
- Commons Collections 3.2
-
getFreq
private static int getFreq(java.lang.Object obj, java.util.Map freqMap)
-
-