Package models.handlers
Interface CollectionHandler<T extends AbstractCollection<E>,E>
- Type Parameters:
T
- Type of CollectionE
- 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 TypeMethodDescriptionvoid
addElementToCollection
(E value) 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.getMax
(Comparator<E> comparator) Gets max element by given comparatorgetMin
(Comparator<E> comparator) Gets min element by given comparatorvoid
setCollection
(T value) Provides method for set collection.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
Provides method for set collection.- Parameters:
value
- Collection
-
addElementToCollection
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
void sort()Provides method for fast sorting collection. You can ignore this method. -
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
Gets min element by given comparator- Parameters:
comparator
- Comparator to compare.- Returns:
- Min element or null if collection is empty
-
getMax
Gets max element by given comparator- Parameters:
comparator
- Comparator to compare.- Returns:
- Max element or null if collection is empty
-