Class VersionedList<T>

java.lang.Object
java.util.AbstractCollection<T>
java.util.AbstractList<T>
com.simsilica.lemur.core.VersionedList<T>
All Implemented Interfaces:
VersionedObject<List<T>>, Iterable<T>, Collection<T>, List<T>, SequencedCollection<T>

public class VersionedList<T> extends AbstractList<T> implements VersionedObject<List<T>>
  • Constructor Details

    • VersionedList

      protected VersionedList(List<T> items, boolean copy)
    • VersionedList

      public VersionedList()
    • VersionedList

      public VersionedList(List<T> items)
  • Method Details

    • wrap

      public static <T> VersionedList<T> wrap(List<T> list)
      Wraps a list in a VersionedList instead of copying it. This is useful for cases where a VersionedList is required but strict versioning is not, for example, passing a static list to a ListBox. Changes to the wrapped list obviously don't trigger version changes in the wrapper. Only changes through the wrapper will increment the version.
    • incrementVersion

      protected void incrementVersion()
    • getVersion

      public long getVersion()
      Description copied from interface: VersionedObject
      Returns the current version of the versioned object.
      Specified by:
      getVersion in interface VersionedObject<T>
    • getObject

      public List<T> getObject()
      Description copied from interface: VersionedObject
      Returns the object that is being versioned.
      Specified by:
      getObject in interface VersionedObject<T>
    • createReference

      public VersionedReference<List<T>> createReference()
      Description copied from interface: VersionedObject
      Creates a new VersionedReference that can be used to monitor when this object changes.
      Specified by:
      createReference in interface VersionedObject<T>
    • get

      public T get(int i)
      Specified by:
      get in interface List<T>
      Specified by:
      get in class AbstractList<T>
    • size

      public int size()
      Specified by:
      size in interface Collection<T>
      Specified by:
      size in interface List<T>
      Specified by:
      size in class AbstractCollection<T>
    • set

      public T set(int i, T val)
      Specified by:
      set in interface List<T>
      Overrides:
      set in class AbstractList<T>
    • add

      public void add(int i, T val)
      Specified by:
      add in interface List<T>
      Overrides:
      add in class AbstractList<T>
    • remove

      public T remove(int i)
      Specified by:
      remove in interface List<T>
      Overrides:
      remove in class AbstractList<T>