Sdílet prostřednictvím


Collections.Disjoint Method

Definition

Returns true if the two specified collections have no elements in common.

[Android.Runtime.Register("disjoint", "(Ljava/util/Collection;Ljava/util/Collection;)Z", "")]
public static bool Disjoint (System.Collections.Generic.ICollection<object> c1, System.Collections.Generic.ICollection<object> c2);
[<Android.Runtime.Register("disjoint", "(Ljava/util/Collection;Ljava/util/Collection;)Z", "")>]
static member Disjoint : System.Collections.Generic.ICollection<obj> * System.Collections.Generic.ICollection<obj> -> bool

Parameters

c1
ICollection<Object>

a collection

c2
ICollection<Object>

a collection

Returns

true if the two specified collections have no elements in common.

Attributes

Remarks

Returns true if the two specified collections have no elements in common.

Care must be exercised if this method is used on collections that do not comply with the general contract for Collection. Implementations may elect to iterate over either collection and test for containment in the other collection (or to perform any equivalent computation). If either collection uses a nonstandard equality test (as does a SortedSet whose ordering is not <em>compatible with equals</em>, or the key set of an IdentityHashMap), both collections must use the same nonstandard equality test, or the result of this method is undefined.

Care must also be exercised when using collections that have restrictions on the elements that they may contain. Collection implementations are allowed to throw exceptions for any operation involving elements they deem ineligible. For absolute safety the specified collections should contain only elements which are eligible elements for both collections.

Note that it is permissible to pass the same collection in both parameters, in which case the method will return true if and only if the collection is empty.

Added in 1.5.

Java documentation for java.util.Collections.disjoint(java.util.Collection<?>, java.util.Collection<?>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to