public class NSSet extends NSObject
LinkedHashSet
or TreeSet
as the underlying
data structure.LinkedHashSet
Constructor and Description |
---|
NSSet()
Creates an empty unordered set.
|
NSSet(boolean ordered)
Creates an empty set.
|
NSSet(boolean ordered,
NSObject... objects)
Create a set and fill it with the given objects.
|
NSSet(NSObject... objects)
Create a set and fill it with the given objects.
|
Modifier and Type | Method and Description |
---|---|
void |
addObject(NSObject obj)
Adds an object to the set.
|
NSObject[] |
allObjects()
Returns all objects contained in the set.
|
NSObject |
anyObject()
Returns one of the objects in the set, or
null
if the set contains no objects. |
boolean |
containsObject(NSObject obj)
Finds out whether a given object is contained in the set.
|
int |
count()
Gets the number of elements in the set.
|
boolean |
equals(Object obj) |
int |
hashCode() |
boolean |
intersectsSet(NSSet otherSet)
Finds out whether at least one object is present in both sets.
|
boolean |
isSubsetOfSet(NSSet otherSet)
Finds out if this set is a subset of the given set.
|
NSObject |
member(NSObject obj)
Determines whether the set contains an object equal to a given object
and returns that object if it is present.
|
Iterator<NSObject> |
objectIterator()
Returns an iterator object that lets you iterate over all elements of the set.
|
void |
removeObject(NSObject obj)
Removes an object from the set.
|
protected void |
toASCII(StringBuilder ascii,
int level)
Returns the ASCII representation of this set.
|
protected void |
toASCIIGnuStep(StringBuilder ascii,
int level)
Returns the ASCII representation of this set according to the GnuStep format.
|
toJavaObject, toXMLPropertyList, wrap, wrap, wrap, wrap, wrap, wrap, wrap, wrap, wrapSerialized
public NSSet()
LinkedHashSet
public NSSet(boolean ordered)
ordered
- Indicates whether the created set should be ordered or unordered.LinkedHashSet
,
TreeSet
public NSSet(NSObject... objects)
objects
- The objects to populate the set.LinkedHashSet
public NSSet(boolean ordered, NSObject... objects)
objects
- The objects to populate the set.LinkedHashSet
,
TreeSet
public void addObject(NSObject obj)
obj
- The object to add.public void removeObject(NSObject obj)
obj
- The object to remove.public NSObject[] allObjects()
public NSObject anyObject()
null
if the set contains no objects.null
if the set is empty.public boolean containsObject(NSObject obj)
obj
- The object to look for.true
, when the object was found, false
otherwise.public NSObject member(NSObject obj)
obj
- The object to look for.null
otherwise.public boolean intersectsSet(NSSet otherSet)
otherSet
- The other set.false
if the intersection of both sets is empty, true
otherwise.public boolean isSubsetOfSet(NSSet otherSet)
otherSet
- The other set.true
if all elements in this set are also present in the other set, false
otherwise.public Iterator<NSObject> objectIterator()
objectEnumerator
in the Cocoa implementation
of NSSet.public int count()
Set.size()
protected void toASCII(StringBuilder ascii, int level)
protected void toASCIIGnuStep(StringBuilder ascii, int level)
toASCIIGnuStep
in class NSObject
ascii
- The ASCII file string builderlevel
- The indentation levelCopyright © 2014. All Rights Reserved.