Package com.complexible.common.base
Class ChangeList<E extends Enum & ChangeType,T>
java.lang.Object
com.complexible.common.base.ChangeList<E,T>
- Type Parameters:
T- the type of the change objects
- All Implemented Interfaces:
AutoCloseable,Iterable<Change<E,T>>
public final class ChangeList<E extends Enum & ChangeType,T>
extends Object
implements Iterable<Change<E,T>>, AutoCloseable
An ordered list of changes to some resource.
- Since:
- 3.0
- Version:
- 3.0
- Author:
- Michael Grove
-
Method Summary
Modifier and TypeMethodDescriptionChangeList<E, T> Add a new Change to the current list of changesChangeList<E, T> Add a new Change to the current list of changes.ChangeList<E, T> Add all the Changes to the current list of changesvoidclear()Clear all changesvoidclose()Close all the change objects in this liststatic <T,E extends Enum & ChangeType>
ChangeList<E, T> create()Create a new list of ChangesbooleanisEmpty()Return whether or not the ChangeList is emptyiterator()intsize()Return the number of changes in this change setMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
create
Create a new list of Changes- Type Parameters:
T- the type of payload in the changes- Returns:
- the new ChangeList
-
clear
public void clear()Clear all changes -
close
Close all the change objects in this list- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
append
Add a new Change to the current list of changes- Parameters:
theChange- the change to add- Returns:
- this ChangeList
-
appendAll
Add all the Changes to the current list of changes- Parameters:
theChange- the change to add- Returns:
- this ChangeList
-
append
Add a new Change to the current list of changes.- Parameters:
theType- the type of changetheChange- the change payload- Returns:
- this ChangeList
-
size
public int size()Return the number of changes in this change set- Returns:
- the number of changes
-
isEmpty
public boolean isEmpty()Return whether or not the ChangeList is empty- Returns:
- true if there are no changes in this list, false otherwise
-
iterator
- Specified by:
iteratorin interfaceIterable<E extends Enum & ChangeType>
-