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 Details

    • create

      public static <T, E extends Enum & ChangeType> ChangeList<E,T> 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

      public void close() throws Exception
      Close all the change objects in this list
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception
    • append

      public ChangeList<E,T> append(Change<E,T> theChange)
      Add a new Change to the current list of changes
      Parameters:
      theChange - the change to add
      Returns:
      this ChangeList
    • appendAll

      public ChangeList<E,T> appendAll(Iterable<Change<E,T>> theChange)
      Add all the Changes to the current list of changes
      Parameters:
      theChange - the change to add
      Returns:
      this ChangeList
    • append

      public ChangeList<E,T> append(E theType, T theChange)
      Add a new Change to the current list of changes.
      Parameters:
      theType - the type of change
      theChange - 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

      public Iterator<Change<E,T>> iterator()
      Specified by:
      iterator in interface Iterable<E extends Enum & ChangeType>