public class NSSet extends NSObject
LinkedHashSet
or TreeSet
as the underlying
data structure.LinkedHashSet
Constructor and Description |
---|
NSSet()
Creates a new NSSet instance.
|
NSSet(boolean ordered)
Creates a new NSSet instance.
|
NSSet(boolean ordered,
NSObject... objects)
Create a new NSSet instance with the specified content.
|
NSSet(NSObject... objects)
Creates a new NSSet instance with the specified content.
|
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. |
NSSet |
clone()
Creates and returns a deep copy of this instance.
|
boolean |
containsObject(NSObject obj)
Finds out whether the 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 the 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.
|
fromJavaObject, toJavaObject, toJavaObject, toXMLPropertyList
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)
ordered
- Indicates whether the created set should be ordered or unordered.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()
public NSSet clone()
NSObject
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 © 2019. All rights reserved.