public class PersistedList<T> extends AbstractList<T>
Modifier and Type | Class and Description |
---|---|
static class |
PersistedList.ConverterImpl
Converter implementation for XStream. |
Modifier and Type | Field and Description |
---|---|
protected CopyOnWriteList<T> |
data |
protected Saveable |
owner |
modCount
Modifier | Constructor and Description |
---|---|
protected |
PersistedList() |
protected |
PersistedList(Collection<? extends T> initialList) |
|
PersistedList(Saveable owner) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(T item) |
boolean |
addAll(Collection<? extends T> items) |
void |
addAllTo(Collection<? super T> dst) |
void |
clear() |
boolean |
contains(Object item) |
<U extends T> |
get(Class<U> type) |
T |
get(int index) |
<U extends T> |
getAll(Class<U> type)
Gets all instances that matches the given type.
|
boolean |
isEmpty() |
Iterator<T> |
iterator() |
protected void |
onModified()
Called when a list is mutated.
|
void |
remove(Class<? extends T> type)
Removes an instance by its type.
|
boolean |
remove(Object o) |
void |
removeAll(Class<? extends T> type) |
void |
replace(T from,
T to)
A convenience method to replace a single item.
|
void |
replaceBy(Collection<? extends T> col) |
void |
setOwner(Saveable owner) |
int |
size() |
<T> T[] |
toArray(T[] array)
Gets all the
Describable s in an array. |
List<T> |
toList()
Returns the snapshot view of instances as list.
|
String |
toString() |
add, addAll, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
containsAll, removeAll, retainAll, toArray
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
containsAll, removeAll, replaceAll, retainAll, sort, spliterator, toArray
parallelStream, removeIf, stream
protected final CopyOnWriteList<T> data
protected Saveable owner
protected PersistedList()
protected PersistedList(Collection<? extends T> initialList)
public PersistedList(Saveable owner)
public void setOwner(Saveable owner)
@WithBridgeMethods(value=void.class) public boolean add(T item)
add
in interface Collection<T>
add
in interface List<T>
add
in class AbstractList<T>
@WithBridgeMethods(value=void.class) public boolean addAll(Collection<? extends T> items)
addAll
in interface Collection<T>
addAll
in interface List<T>
addAll
in class AbstractCollection<T>
public void replaceBy(Collection<? extends T> col) throws IOException
IOException
public T get(int index)
public <U extends T> List<U> getAll(Class<U> type)
public int size()
size
in interface Collection<T>
size
in interface List<T>
size
in class AbstractCollection<T>
public void remove(Class<? extends T> type) throws IOException
IOException
public void replace(T from, T to) throws IOException
IOException
public boolean remove(Object o)
remove
in interface Collection<T>
remove
in interface List<T>
remove
in class AbstractCollection<T>
public void removeAll(Class<? extends T> type) throws IOException
IOException
public void clear()
clear
in interface Collection<T>
clear
in interface List<T>
clear
in class AbstractList<T>
protected void onModified() throws IOException
IOException
public <T> T[] toArray(T[] array)
Describable
s in an array.toArray
in interface Collection<T>
toArray
in interface List<T>
toArray
in class AbstractCollection<T>
public void addAllTo(Collection<? super T> dst)
public boolean isEmpty()
isEmpty
in interface Collection<T>
isEmpty
in interface List<T>
isEmpty
in class AbstractCollection<T>
public boolean contains(Object item)
contains
in interface Collection<T>
contains
in interface List<T>
contains
in class AbstractCollection<T>
public String toString()
toString
in class AbstractCollection<T>
Copyright © 2004–2021. All rights reserved.