Class ObjectSet<O extends ObjectType>
java.lang.Object
com.evolveum.midpoint.schema.util.ObjectSet<O>
- All Implemented Interfaces:
Iterable<O>
,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 uses AbstractMutableObjectable.hashCode()
and
ObjectType.equals(Object)
methods.
We intentionally do not implement Set
interface, because we do not fulfill its contract.
Requirement: only objects with OID can be stored here.
TODO better name-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
addAll
(@NotNull Collection<? extends O> c) asList()
@NotNull List<PrismObject<O>>
void
clear()
boolean
boolean
containsAll
(@NotNull Collection<?> c) boolean
containsOid
(String oid) boolean
isEmpty()
iterator()
static <O extends ObjectType>
ObjectSet<O>of
(O... objects) static <O extends ObjectType>
ObjectSet<O>ofPrismObjects
(Collection<PrismObject<O>> objects) oidSet()
boolean
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 Details
-
ObjectSet
public ObjectSet() -
ObjectSet
-
-
Method Details
-
of
-
ofPrismObjects
public static <O extends ObjectType> ObjectSet<O> ofPrismObjects(Collection<PrismObject<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
- Specified by:
contains
in interfaceCollection<O extends ObjectType>
-
iterator
- Specified by:
iterator
in interfaceCollection<O extends ObjectType>
- Specified by:
iterator
in interfaceIterable<O extends ObjectType>
-
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
- Specified by:
add
in interfaceCollection<O extends ObjectType>
-
remove
- Specified by:
remove
in interfaceCollection<O extends ObjectType>
-
containsAll
- Specified by:
containsAll
in interfaceCollection<O extends ObjectType>
-
addAll
- Specified by:
addAll
in interfaceCollection<O extends ObjectType>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<O extends ObjectType>
-
retainAll
- Specified by:
retainAll
in interfaceCollection<O extends ObjectType>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<O extends ObjectType>
-
asList
-
asPrismObjectList
-
containsOid
-
get
-
oidSet
-