Package com.simsilica.lemur.core
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>
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsModifierConstructorDescriptionVersionedList(List<T> items) protectedVersionedList(List<T> items, boolean copy) -
Method Summary
Modifier and TypeMethodDescriptionvoidCreates a new VersionedReference that can be used to monitor when this object changes.get(int i) Returns the object that is being versioned.longReturns the current version of the versioned object.protected voidremove(int i) intsize()static <T> VersionedList<T> Wraps a list in a VersionedList instead of copying it.Methods inherited from class java.util.AbstractList
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subListMethods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
addAll, addFirst, addLast, contains, containsAll, getFirst, getLast, isEmpty, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, sort, spliterator, toArray, toArray
-
Constructor Details
-
VersionedList
-
VersionedList
public VersionedList() -
VersionedList
-
-
Method Details
-
wrap
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:VersionedObjectReturns the current version of the versioned object.- Specified by:
getVersionin interfaceVersionedObject<T>
-
getObject
Description copied from interface:VersionedObjectReturns the object that is being versioned.- Specified by:
getObjectin interfaceVersionedObject<T>
-
createReference
Description copied from interface:VersionedObjectCreates a new VersionedReference that can be used to monitor when this object changes.- Specified by:
createReferencein interfaceVersionedObject<T>
-
get
-
size
public int size()- Specified by:
sizein interfaceCollection<T>- Specified by:
sizein interfaceList<T>- Specified by:
sizein classAbstractCollection<T>
-
set
-
add
-
remove
-