Class IterableSearcher

java.lang.Object
ch.nolix.base.commontype.iteratortool.IterableSearcher
All Implemented Interfaces:
IIterableCountSearcher, IIterableSearcher

public final class IterableSearcher extends Object implements IIterableSearcher
Author:
Silvan Wyss
  • Constructor Details

    • IterableSearcher

      public IterableSearcher()
  • Method Details

    • getCount

      public int getCount(Iterable<?> iterable)
      Specified by:
      getCount in interface IIterableCountSearcher
      Parameters:
      iterable - the examined Iterable, is considered to be empty when is null
      Returns:
      the number of elements of the given iterable
    • getStoredAtOneBasedIndex

      public <E> E getStoredAtOneBasedIndex(Iterable<E> iterable, int oneBasedIndex)
      Specified by:
      getStoredAtOneBasedIndex in interface IIterableSearcher
      Type Parameters:
      E - the type of the elements of the given iterable
      Parameters:
      iterable - the searched Iterable, is considered to be empty when is null
      oneBasedIndex - the one-based index at which an element is requested
      Returns:
      the element at the given oneBasedIndexed from the given iterable