T
- the type of object stored by this classpublic class ClassIndexedSet<T> extends AbstractSet<T> implements Set<T>
Modifier and Type | Class and Description |
---|---|
protected class |
ClassIndexedSet.ClassIndexedSetIterator
Iterator for set implementation
ClassIndexedSet . |
Constructor and Description |
---|
ClassIndexedSet()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(T o) |
boolean |
add(T o,
boolean replace)
Add member to set, optionally replacing any existing instance of the
same class.
|
void |
clear() |
boolean |
contains(Class<? extends T> clazz)
Check whether set contains an instance of the specified class.
|
<X extends T> |
get(Class<X> clazz)
Get the set element specified by the class parameter.
|
protected Class<? extends T> |
getIndexClass(Object o)
Get the index class of the specified object.
|
Iterator<T> |
iterator() |
boolean |
remove(Object o) |
int |
size() |
equals, hashCode, removeAll
addAll, contains, containsAll, isEmpty, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, contains, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, spliterator, toArray, toArray
parallelStream, removeIf, stream
public boolean add(T o)
add
in interface Collection<T>
add
in interface Set<T>
add
in class AbstractCollection<T>
public boolean add(T o, boolean replace) throws NullPointerException, IllegalArgumentException
o
- the object to addreplace
- flag indicating whether to replace an existing class typeIllegalArgumentException
- if set already contained an instance of the object's class
and replacement was specified as falseNullPointerException
- if the object to add was nullpublic void clear()
clear
in interface Collection<T>
clear
in interface Set<T>
clear
in class AbstractCollection<T>
public boolean remove(Object o)
remove
in interface Collection<T>
remove
in interface Set<T>
remove
in class AbstractCollection<T>
public int size()
size
in interface Collection<T>
size
in interface Set<T>
size
in class AbstractCollection<T>
public boolean contains(Class<? extends T> clazz)
clazz
- the class to checkpublic <X extends T> X get(Class<X> clazz)
X
- generic parameter which eliminates need for casting by the callerclazz
- the class to whose instance is to be retrievedprotected Class<? extends T> getIndexClass(Object o)
o
- the object whose class index to determineCopyright © 1999–2015. All rights reserved.