Type Parameters: E - the type of object the Collection contains Parameters: collection - the collection whose contents are the target of the retainAll operation retain - the collection containing the elements to be retained in the returned collection equator - the Equator used for testing equality Returns: a Collection containing all the elements of collection Modified without changing the object itself. Useful in cases where the equals behavior of an object needs to be Object.equals(Object) to determine the equality of the elements Moreover this method uses an Equator instead of Modify the collection c and thus cannot call This method is useful if you do not wish to Unless retain does not contain e, in which case The same as the cardinality of e in collection Returns a collection containing all the elements inĬardinality of an element e in the returned collection is retainAll public static Collection retainAll( Iterable collection,.Throws: NullPointerException - if either parameter is null Since: 3.2 Type Parameters: C - the type of object the Collection contains Parameters: collection - the collection whose contents are the target of the #retailAll operation retain - the collection containing the elements to be retained in the returned collection Returns: a Collection containing all the elements of collection As a consequence, it is advised to use a collection type for This implementation iterates over collection, checking each element in The collection c and thus cannot call c.retainAll(retain). This method is useful if you do not wish to modify In collection unless retain does not contain e, in whichĬase the cardinality is zero. In the returned collection is the same as the cardinality of e Returns a collection containing all the elements in collection get public static Map.Entry get( Map map,.Parameters: object - the object to get a value from index - the index to get Returns: the object at the specified index Throws: IndexOutOfBoundsException - if the index is invalid IllegalArgumentException - if the object type is invalid Number of entries) as a side effect of this method. Index (or to the end, if index exceeds the Index-th object in the Iterator/Enumeration, if there Iterator or Enumeration - the value returned is the.Returned by the collection's default iterator, if there is such an element. Collection - the value returned is the index-th object.If there is such an entry otherwise an IndexOutOfBoundsException Array - the index-th array entry is returned,.List - this method is equivalent to the list's get method.Map - the value returned is the Map.Entry in position.The supported types, and associated semantics are: IllegalArgumentException if object is not an IndexOutOfBoundsException if there is no such element or Returns the index-th value in object, throwing selectRejected public static Collection selectRejected( Iterable inputCollection,.InputCollection or predicate are not null Returns: the outputCollection Since: 4.1 InputCollection and predicate are not null rejectedCollection - the collection to output rejected elements into, may not be null if the Type Parameters: O - the type of object the Iterable contains R - the type of the output Collection Parameters: inputCollection - the collection to get the input from, may be null predicate - the predicate to use, may be null outputCollection - the collection to output selected elements into, may not be null if the SelectRejected(inputCollection, predicate, rejectedCollection) Select(inputCollection, predicate, outputCollection) Note: calling the method is equivalent to the following code snippet: If the input predicate is null, no elements are added to Selects all elements from inputCollection into an output and rejected collection,īased on the evaluation of the given predicate.Įlements matching the predicate are added to the outputCollection,Īll other elements are added to the rejectedCollection. containsAny public static boolean containsAny( Collection coll1,.Parameters: coll1 - the first collection, must not be null coll2 - the second collection, must not be null Returns: true iff the intersection of the collections has the same cardinalityĪs the set of unique elements from the second collection Since: 4.0 Depending on the type ofĬollection provided, this method will be much faster than callingĬntainsAll(Collection) instead, though this will come at theĬost of an additional space complexity O(n). With a guaranteed runtime complexity of O(n + m). This method is intended as a replacement for ntainsAll(Collection) Intersection(, ) of coll1 and coll2 has the same cardinality as In other words, this method returns true iff the Which is the same behavior as ntainsAll(Collection). The cardinality of values in coll2 is not taken into account, Returns true iff all elements of coll2 are also contained
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |