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) protected
VersionedList
(List<T> items, boolean copy) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Creates a new VersionedReference that can be used to monitor when this object changes.get
(int i) Returns the object that is being versioned.long
Returns the current version of the versioned object.protected void
remove
(int i) int
size()
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, subList
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods 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:VersionedObject
Returns the current version of the versioned object.- Specified by:
getVersion
in interfaceVersionedObject<T>
-
getObject
Description copied from interface:VersionedObject
Returns the object that is being versioned.- Specified by:
getObject
in interfaceVersionedObject<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 interfaceVersionedObject<T>
-
get
-
size
public int size()- Specified by:
size
in interfaceCollection<T>
- Specified by:
size
in interfaceList<T>
- Specified by:
size
in classAbstractCollection<T>
-
set
-
add
-
remove
-