Interface CollectionHandler<T extends AbstractCollection<E>,E>

Type Parameters:
T - Type of Collection
E - Type of Elements
All Known Implementing Classes:
RoutesHandler

public interface CollectionHandler<T extends AbstractCollection<E>,E>
Base interface for handling Collection of Elements. You should implement it in your handler for correct command working.
Since:
1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Provides method for fast adding element in collection.
    void
    Provides method for fast clear element in collection.
    Provides method for get collection.
    Provides method for fast getting first element.
    Provides method for get collection initDate.
    Provides method for getting last element.
    E
    getMax (Comparator<E> comparator)
    Gets max element by given comparator
    getMin (Comparator<E> comparator)
    Gets min element by given comparator
    T
    Provides method for getting sorted variant of collection.
    void
    setCollection (T value)
    Provides method for set collection.
    default void
    sort()
    Provides method for fast sorting collection.
    void
    Provides method for validate elements in collection.
  • Method Details

    • getCollection

      T getCollection()
      Provides method for get collection.
      Returns:
      Actual collection reference
    • setCollection

      void setCollection(T value)
      Provides method for set collection.
      Parameters:
      value - Collection
    • addElementToCollection

      void addElementToCollection(E value)
      Provides method for fast adding element in collection.
      Parameters:
      value - Element to add
    • clearCollection

      void clearCollection()
      Provides method for fast clear element in collection.
    • sort

      default void sort()
      Provides method for fast sorting collection. You can ignore this method.
    • getSorted

      T getSorted()
      Provides method for getting sorted variant of collection.
      Returns:
      sorted collection
    • getFirstOrNew

      E getFirstOrNew()
      Provides method for fast getting first element.
      Returns:
      First element. If collection was empty, creates new Element and returns it.
    • getInitDate

      Date getInitDate()
      Provides method for get collection initDate.
      Returns:
      Date instance -- Collection created time.
      See Also:
    • getLastElement

      E getLastElement()
      Provides method for getting last element.
      Returns:
      Last element. If collection was empty, returns null.
    • validateElements

      void validateElements()
      Provides method for validate elements in collection. You can ignore this method
    • getMin

      E getMin(Comparator<E> comparator)
      Gets min element by given comparator
      Parameters:
      comparator - Comparator to compare.
      Returns:
      Min element or null if collection is empty
    • getMax

      E getMax(Comparator<E> comparator)
      Gets max element by given comparator
      Parameters:
      comparator - Comparator to compare.
      Returns:
      Max element or null if collection is empty