Class ObjectSet<O extends ObjectType>
- java.lang.Object
-
- com.evolveum.midpoint.schema.util.ObjectSet<O>
-
- All Implemented Interfaces:
Iterable<O>
,Collection<O>
@Experimental public class ObjectSet<O extends ObjectType> extends Object implements Collection<O>
This is a set of objects that considers objects being equal by simply comparing their OIDs. It should be more efficient and robust than e.g.HashSet
that usesAbstractMutableObjectable.hashCode()
andObjectType.equals(Object)
methods. We intentionally do not implementSet
interface, because we do not fulfill its contract. Requirement: only objects with OID can be stored here. TODO better name
-
-
Constructor Summary
Constructors Constructor Description ObjectSet()
ObjectSet(Collection<? extends O> initialObjects)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(O o)
boolean
addAll(@NotNull Collection<? extends O> c)
@NotNull List<O>
asList()
void
clear()
boolean
contains(Object o)
boolean
containsAll(@NotNull Collection<?> c)
boolean
containsOid(String oid)
O
get(String oid)
boolean
isEmpty()
@NotNull Iterator<O>
iterator()
static <O extends ObjectType>
ObjectSet<O>of(O... objects)
boolean
remove(Object o)
boolean
removeAll(@NotNull Collection<?> c)
boolean
retainAll(@NotNull Collection<?> c)
int
size()
@NotNull Object[]
toArray()
<T> @NotNull T[]
toArray(@NotNull T[] a)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
-
-
-
Constructor Detail
-
ObjectSet
public ObjectSet()
-
ObjectSet
public ObjectSet(Collection<? extends O> initialObjects)
-
-
Method Detail
-
of
@SafeVarargs public static <O extends ObjectType> ObjectSet<O> of(O... objects)
-
size
public int size()
- Specified by:
size
in interfaceCollection<O extends ObjectType>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceCollection<O extends ObjectType>
-
contains
public boolean contains(Object o)
- Specified by:
contains
in interfaceCollection<O extends ObjectType>
-
iterator
@NotNull public @NotNull Iterator<O> iterator()
- Specified by:
iterator
in interfaceCollection<O extends ObjectType>
- Specified by:
iterator
in interfaceIterable<O extends ObjectType>
-
toArray
@NotNull public @NotNull Object[] toArray()
- Specified by:
toArray
in interfaceCollection<O extends ObjectType>
-
toArray
@NotNull public <T> @NotNull T[] toArray(@NotNull @NotNull T[] a)
- Specified by:
toArray
in interfaceCollection<O extends ObjectType>
-
add
public boolean add(O o)
- Specified by:
add
in interfaceCollection<O extends ObjectType>
-
remove
public boolean remove(Object o)
- Specified by:
remove
in interfaceCollection<O extends ObjectType>
-
containsAll
public boolean containsAll(@NotNull @NotNull Collection<?> c)
- Specified by:
containsAll
in interfaceCollection<O extends ObjectType>
-
addAll
public boolean addAll(@NotNull @NotNull Collection<? extends O> c)
- Specified by:
addAll
in interfaceCollection<O extends ObjectType>
-
removeAll
public boolean removeAll(@NotNull @NotNull Collection<?> c)
- Specified by:
removeAll
in interfaceCollection<O extends ObjectType>
-
retainAll
public boolean retainAll(@NotNull @NotNull Collection<?> c)
- Specified by:
retainAll
in interfaceCollection<O extends ObjectType>
-
clear
public void clear()
- Specified by:
clear
in interfaceCollection<O extends ObjectType>
-
containsOid
public boolean containsOid(String oid)
-
-