Package hudson.util
Class PersistedList<T>
java.lang.Object
java.util.AbstractCollection<T>
java.util.AbstractList<T>
hudson.util.PersistedList<T>
- All Implemented Interfaces:
Iterable<T>,Collection<T>,List<T>
- Direct Known Subclasses:
DescribableList
Collection whose change is notified to the parent object for persistence.
- Since:
- 1.333
- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classConverterimplementation for XStream. -
Field Summary
FieldsFields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPersistedList(Saveable owner) protectedPersistedList(Collection<? extends T> initialList) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanaddAll(Collection<? extends T> items) voidaddAllTo(Collection<? super T> dst) voidclear()booleanget(int index) <U extends T>
UGets all instances that matches the given type.booleanisEmpty()iterator()protected voidCalled when a list is mutated.voidRemoves an instance by its type.booleanvoidvoidA convenience method to replace a single item.voidreplaceBy(Collection<? extends T> col) voidintsize()<X> X[]toArray(X[] array) Gets all theDescribables in an array.toList()Returns the snapshot view of instances as list.toString()Methods inherited from class java.util.AbstractList
add, addAll, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subListMethods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toArrayMethods 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
containsAll, removeAll, replaceAll, retainAll, sort, spliterator, toArray
-
Field Details
-
data
-
owner
-
-
Constructor Details
-
PersistedList
protected PersistedList() -
PersistedList
-
PersistedList
-
-
Method Details
-
setOwner
-
add
- Specified by:
addin interfaceCollection<T>- Specified by:
addin interfaceList<T>- Overrides:
addin classAbstractList<T>
-
addAll
- Specified by:
addAllin interfaceCollection<T>- Specified by:
addAllin interfaceList<T>- Overrides:
addAllin classAbstractCollection<T>
-
replaceBy
- Throws:
IOException
-
get
-
get
-
getAll
Gets all instances that matches the given type. -
size
public int size()- Specified by:
sizein interfaceCollection<T>- Specified by:
sizein interfaceList<T>- Specified by:
sizein classAbstractCollection<T>
-
remove
Removes an instance by its type.- Throws:
IOException
-
replace
A convenience method to replace a single item. This method shouldn't be used when you are replacing a lot of stuff as copy-on-write semantics make this rather slow.- Throws:
IOException
-
remove
- Specified by:
removein interfaceCollection<T>- Specified by:
removein interfaceList<T>- Overrides:
removein classAbstractCollection<T>
-
removeAll
- Throws:
IOException
-
clear
public void clear()- Specified by:
clearin interfaceCollection<T>- Specified by:
clearin interfaceList<T>- Overrides:
clearin classAbstractList<T>
-
iterator
-
onModified
Called when a list is mutated.- Throws:
IOException
-
toList
Returns the snapshot view of instances as list. -
toArray
public <X> X[] toArray(X[] array) Gets all theDescribables in an array.- Specified by:
toArrayin interfaceCollection<T>- Specified by:
toArrayin interfaceList<T>- Overrides:
toArrayin classAbstractCollection<T>
-
addAllTo
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<T>- Specified by:
isEmptyin interfaceList<T>- Overrides:
isEmptyin classAbstractCollection<T>
-
contains
- Specified by:
containsin interfaceCollection<T>- Specified by:
containsin interfaceList<T>- Overrides:
containsin classAbstractCollection<T>
-
toString
- Overrides:
toStringin classAbstractCollection<T>
-