Package model.handler

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
Author:
Zerumi
  • 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
    • 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.
    • 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
    • addCollectionListener

      void addCollectionListener (CollectionUpdateListener<E> listener)
      Registers new listener for some collection operations.
      Parameters:
      listener - Listener
      Since:
      4.0