Package ca.uhn.fhir.util
Class CollectionUtil
java.lang.Object
ca.uhn.fhir.util.CollectionUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Set
<T> newSet
(T... theValues) This method is equivalent toSet.of(...)
but is kept here and used instead of that method because Set.of is not present on Android SDKs (at least up to 29).static <T> Collection
<T> nullSafeUnion
(Collection<T> theCollection0, Collection<T> theCollection1) Returns an immutable union of both collections.
-
Method Details
-
nullSafeUnion
@Nonnull public static <T> Collection<T> nullSafeUnion(@Nullable Collection<T> theCollection0, @Nullable Collection<T> theCollection1) Returns an immutable union of both collections. If either or both arguments arenull
they will be treated as an empty collection, meaning that even if both arguments arenull
, an empty immutable collection will be returned.DO NOT use this method if the underlying collections can be changed after calling this method, as the behaviour is indeterminate.
- Parameters:
theCollection0
- The first set in the union, ornull
.theCollection1
- The second set in the union, ornull
.- Returns:
- Returns a union of both collections. Will not return
null
ever. - Since:
- 7.4.0
-
newSet
This method is equivalent toSet.of(...)
but is kept here and used instead of that method because Set.of is not present on Android SDKs (at least up to 29).Sets returned by this method are unmodifiable.
-