T
- the type of the orderablespublic class OrderableManager<T extends Orderable> extends Object
Constructor and Description |
---|
OrderableManager(Comparator<Orderable> comparator,
boolean allowDuplicates)
Create a manager for orderable items.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(T orderable)
Add a new item.
|
List<T> |
getAll() |
T |
getFirst() |
T |
getLast() |
boolean |
isAllowDuplicates() |
boolean |
remove(T orderable)
Remove a previously added item.
|
public OrderableManager(Comparator<Orderable> comparator, boolean allowDuplicates)
comparator
- the comparator to use for sorting the added items.allowDuplicates
- whether duplicates should be allowed when adding new items. If false a new item
will not be added if it already exists.public boolean add(T orderable)
orderable
- the item to addpublic List<T> getAll()
public T getFirst()
public T getLast()
public boolean isAllowDuplicates()
public boolean remove(T orderable)
orderable
- the item to removeCopyright © 2019 Communote team. All rights reserved.