Class TypeSet
java.lang.Object
net.okapia.osid.torrefacto.collect.TypeSet
- Direct Known Subclasses:
TypeEnumSet
A
Types collection that holds each type at most once. A type
is uniquely identified by its namespace, authority, and identifier,
so adding one that is already present is a no-op and a single remove
drops it. Insertion order is preserved.
This utility helps a provider manage type support. When support may
be registered and withdrawn from several sources, use the
reference-counted TypeRefSet instead. The backing set is
synchronized.-
Constructor Details
-
TypeSet
public TypeSet()Creates a new TypeSet. -
TypeSet
Creates a new TypeSet for a given collection of types.- Parameters:
types- the initial types- Throws:
NullArgumentException-typesisnull
-
TypeSet
Creates a new TypeSet for a given array of types.- Parameters:
types- the initial types- Throws:
NullArgumentException-typesisnull
-
-
Method Details
-
add
Tracks a supported type.- Specified by:
addin interfaceTypes- Parameters:
type- the type- Throws:
NullArgumentException-typeisnull
-
remove
Removes a type.- Specified by:
removein interfaceTypes- Parameters:
type- the type- Throws:
NullArgumentException-typeisnull
-
contains
Tests for the existience of a type.- Specified by:
containsin interfaceTypes- Parameters:
type- the type- Returns:
trueif the type exists,falseotherwise- Throws:
NullArgumentException-typeisnull
-
toCollection
Gets an iterable collection of the types.- Specified by:
toCollectionin interfaceTypes- Returns:
- a collection
-
toArray
-
clear
-
iterator
-