Class CollectionUtils

java.lang.Object
nl.vpro.domain.media.CollectionUtils

public class CollectionUtils extends Object
Some static methods used in this package that are related to dealing with collections
Since:
5.12
Author:
Michiel Meeuwissen
  • Method Details

    • getFromList

      protected static <E> @Nullable E getFromList(@Nullable List<@NonNull E> list)
    • indexOf

      public static <E> int indexOf(List<E> list, E o, int offset)
    • createIfNull

      public static <P extends Comparable<P>> SortedSet<P> createIfNull(SortedSet<P> set)
    • createIfNullUnlessNull

      public static <P extends Comparable<P>> @Nullable SortedSet<P> createIfNullUnlessNull(@Nullable SortedSet<P> set, @Nullable Object check)
    • inCollection

      public static <P> boolean inCollection(Collection<P> col, P element)
      null-safe Collection.contains(Object). null is never in the list.

      Mainly because link java 9's Immutable lists resulting from things as List.of() throw exception if called with null (Things like Collections.unmodifiableList(List) didn't behave like that).

      Since:
      7.2