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.HashSetthat usesAbstractMutableObjectable.hashCode()andObjectType.equals(Object)methods. We intentionally do not implementSetinterface, 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 booleanadd(O o)booleanaddAll(@NotNull Collection<? extends O> c)@NotNull List<O>asList()voidclear()booleancontains(Object o)booleancontainsAll(@NotNull Collection<?> c)booleancontainsOid(String oid)Oget(String oid)booleanisEmpty()@NotNull Iterator<O>iterator()static <O extends ObjectType>
ObjectSet<O>of(O... objects)booleanremove(Object o)booleanremoveAll(@NotNull Collection<?> c)booleanretainAll(@NotNull Collection<?> c)intsize()@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:
sizein interfaceCollection<O extends ObjectType>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceCollection<O extends ObjectType>
-
contains
public boolean contains(Object o)
- Specified by:
containsin interfaceCollection<O extends ObjectType>
-
iterator
@NotNull public @NotNull Iterator<O> iterator()
- Specified by:
iteratorin interfaceCollection<O extends ObjectType>- Specified by:
iteratorin interfaceIterable<O extends ObjectType>
-
toArray
@NotNull public @NotNull Object[] toArray()
- Specified by:
toArrayin interfaceCollection<O extends ObjectType>
-
toArray
@NotNull public <T> @NotNull T[] toArray(@NotNull @NotNull T[] a)- Specified by:
toArrayin interfaceCollection<O extends ObjectType>
-
add
public boolean add(O o)
- Specified by:
addin interfaceCollection<O extends ObjectType>
-
remove
public boolean remove(Object o)
- Specified by:
removein interfaceCollection<O extends ObjectType>
-
containsAll
public boolean containsAll(@NotNull @NotNull Collection<?> c)- Specified by:
containsAllin interfaceCollection<O extends ObjectType>
-
addAll
public boolean addAll(@NotNull @NotNull Collection<? extends O> c)- Specified by:
addAllin interfaceCollection<O extends ObjectType>
-
removeAll
public boolean removeAll(@NotNull @NotNull Collection<?> c)- Specified by:
removeAllin interfaceCollection<O extends ObjectType>
-
retainAll
public boolean retainAll(@NotNull @NotNull Collection<?> c)- Specified by:
retainAllin interfaceCollection<O extends ObjectType>
-
clear
public void clear()
- Specified by:
clearin interfaceCollection<O extends ObjectType>
-
containsOid
public boolean containsOid(String oid)
-
-