Class IterableExaminer

java.lang.Object
ch.nolix.base.commontypetool.iterableexaminer.IterableExaminer
All Implemented Interfaces:
IIterableContainExaminer, IIterableContainMatchingExaminer, IIterableContainMultipleObjectExaminer, IIterableContainObjectExaminer, IIterableExaminer

public final class IterableExaminer extends Object implements IIterableExaminer
Author:
Silvan Wyss
  • Constructor Details

    • IterableExaminer

      public IterableExaminer()
  • Method Details

    • contains

      public boolean contains(Iterable<?> iterable, Object object)
      Specified by:
      contains in interface IIterableContainObjectExaminer
      Parameters:
      iterable - the searched Iterable, is considered to be empty when is null
      object -
      Returns:
      true if the given iterable contains the given object, false otherwise
    • containsAll

      public boolean containsAll(Iterable<?> iterable, Iterable<?> objects)
      Specified by:
      containsAll in interface IIterableContainMultipleObjectExaminer
      Parameters:
      iterable - the searched Iterable, is considered to be empty when is null
      objects - the searched for Objects, is considered to be empty when is null
      Returns:
      true if the given iterable contains all of the given objects, false otherwise
    • containsAll

      public boolean containsAll(Iterable<? extends Object> iterable, Object... objects)
      Specified by:
      containsAll in interface IIterableContainMultipleObjectExaminer
      Parameters:
      iterable - the searched Iterable, is considered to be empty when is null
      objects - the searched for Objects, is considered to be empty when is null
      Returns:
      true if the given iterable contains all of the given objects, false otherwise
    • containsAny

      public boolean containsAny(Iterable<?> iterable)
      Specified by:
      containsAny in interface IIterableContainExaminer
      Parameters:
      iterable - the searched Iterable, is considered to be empty when is null
      Returns:
      true if the given iterable contains an element, false otherwise
    • containsAny

      public boolean containsAny(Iterable<?> iterable, Iterable<?> objects)
      Specified by:
      containsAny in interface IIterableContainMultipleObjectExaminer
      Parameters:
      iterable - the searched Iterable, is considered to be empty when is null
      objects - the searched for Objects, is considered to be empty when is null
      Returns:
      true if the given iterable contains any of the given objects, false otherwise
    • containsAny

      public boolean containsAny(Iterable<?> iterable, Object... objects)
      Specified by:
      containsAny in interface IIterableContainMultipleObjectExaminer
      Parameters:
      iterable - the searched Iterable, is considered to be empty when is null
      objects - the searched for Objects, is considered to be empty when is null
      Returns:
      true if the given iterable contains any of the given objects, false otherwise
    • containsExactlyAll

      public boolean containsExactlyAll(Iterable<?> iterable, Iterable<?> objects)
      Specified by:
      containsExactlyAll in interface IIterableContainMultipleObjectExaminer
      Parameters:
      iterable - the searched Iterable, is considered to be empty when is null
      objects - the searched for Objects, is considered to be empty when is null
      Returns:
      true if the given iterable contains exactly all the given objects, false otherwise
    • containsExactlyAll

      public boolean containsExactlyAll(Iterable<?> iterable, Object... objects)
      Specified by:
      containsExactlyAll in interface IIterableContainMultipleObjectExaminer
      Parameters:
      iterable - the searched Iterable, is considered to be empty when is null
      objects - the searched for Objects, is considered to be empty when is null
      Returns:
      true if the given iterable contains exactly all the given objects, false otherwise
    • containsExactlyAllInSameOrder

      public boolean containsExactlyAllInSameOrder(Iterable<?> iterable, Iterable<?> objects)
      Specified by:
      containsExactlyAllInSameOrder in interface IIterableContainMultipleObjectExaminer
      Parameters:
      iterable - the searched Iterable, is considered to be empty when is null
      objects - the searched for Objects, is considered to be empty when is null
      Returns:
      true if the given iterable contains exactly all the given objects in the same order, false otherwise
    • containsExactlyAllInSameOrder

      public boolean containsExactlyAllInSameOrder(Iterable<?> iterable, Object... objects)
      Specified by:
      containsExactlyAllInSameOrder in interface IIterableContainMultipleObjectExaminer
      Parameters:
      iterable - the searched Iterable, is considered to be empty when is null
      objects - the searched for Objects, is considered to be empty when is null
      Returns:
      true if the given iterable contains exactly all the given objects in the same order, false otherwise
    • containsMatching

      public <T> boolean containsMatching(Iterable<T> iterable, Predicate<T> selector)
      Specified by:
      containsMatching in interface IIterableContainMatchingExaminer
      Type Parameters:
      T - the type of the elements of the given iterable
      Parameters:
      iterable - the searched Iterable, is considered to be empty when is null
      selector - can select elements, is considered not to select any element when is null
      Returns:
      true if the given iterable contains an element the given selector selects, false otherwise. Ignores null elements in the given iterable.
    • containsMatchingOnly

      public <T> boolean containsMatchingOnly(Iterable<T> iterable, Predicate<T> selector)
      Specified by:
      containsMatchingOnly in interface IIterableContainMatchingExaminer
      Type Parameters:
      T - the type of the elements of the given iterable
      Parameters:
      iterable - the searched Iterable, is considered to be empty when is null
      selector - can select elements, is considered not to select any element when is null
      Returns:
      true if the given iterable contains only elements the given selector selects, false otherwise. Ignores null elements in the given iterable.
    • containsNone

      public boolean containsNone(Iterable<?> iterable, Iterable<?> objects)
      Specified by:
      containsNone in interface IIterableContainMultipleObjectExaminer
      Parameters:
      iterable - the searched Iterable, is considered to be empty when is null
      objects - the searched for Objects, is considered to be empty when is null
      Returns:
      true if the given iterable does not contain any of the given objects, false otherwise
    • containsNone

      public boolean containsNone(Iterable<?> iterable, Object... objects)
      Specified by:
      containsNone in interface IIterableContainMultipleObjectExaminer
      Parameters:
      iterable - the searched Iterable, is considered to be empty when is null
      objects - the searched for Objects, is considered to be empty when is null
      Returns:
      true if the given iterable does not contain any of the given objects, false otherwise
    • containsNonNull

      public boolean containsNonNull(Iterable<?> iterable)
      Specified by:
      containsNonNull in interface IIterableContainExaminer
      Parameters:
      iterable - the searched Iterable, is considered to be empty when is null
      Returns:
      true if the given iterable contains a non-null element, false otherwise.
    • containsOnce

      public boolean containsOnce(Iterable<?> iterable, Object object)
      Specified by:
      containsOnce in interface IIterableContainObjectExaminer
      Parameters:
      iterable - the searched Iterable, is considered to be empty when is null
      object -
      Returns:
      true if the given iterable contains the given object exactly 1 time, false otherwise
    • containsOneMatching

      public <T> boolean containsOneMatching(Iterable<T> iterable, Predicate<T> selector)
      Specified by:
      containsOneMatching in interface IIterableContainMatchingExaminer
      Type Parameters:
      T - the type of the elements of the given iterable
      Parameters:
      iterable - the searched Iterable, is considered to be empty when is null
      selector - can select elements, is considered not to select any element when is null
      Returns:
      true if the given iterable contains exactly 1 element the given selector selects, false otherwise. Ignores null elements in the given iterable.
    • containsOnly

      public boolean containsOnly(Iterable<?> iterable, Object object)
      Specified by:
      containsOnly in interface IIterableContainObjectExaminer
      Parameters:
      iterable - the searched Iterable, is considered to be empty when is null
      object -
      Returns:
      true if the given iterable contains only the given object, whether 1 or several times, false otherwise
    • isEmpty

      public boolean isEmpty(Iterable<?> iterable)
      Specified by:
      isEmpty in interface IIterableContainExaminer
      Parameters:
      iterable - the searched Iterable, is considered to be empty when is null
      Returns:
      true if the given iterable is empty, false otherwise