Package hudson.util
Class PersistedList<T>
java.lang.Object
java.util.AbstractCollection<E>
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
Modifier and TypeClassDescriptionstatic class
Converter
implementation for XStream. -
Field Summary
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
ModifierConstructorDescriptionprotected
PersistedList
(Saveable owner) protected
PersistedList
(Collection<? extends T> initialList) -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
addAll
(Collection<? extends T> items) void
addAllTo
(Collection<? super T> dst) void
clear()
boolean
get
(int index) <U extends T>
UGets all instances that matches the given type.boolean
isEmpty()
iterator()
protected void
Called when a list is mutated.void
Removes an instance by its type.boolean
void
void
A convenience method to replace a single item.void
replaceBy
(Collection<? extends T> col) void
int
size()
<X> X[]
toArray
(X[] array) Gets all theDescribable
s 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, subList
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toArray
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
containsAll, removeAll, replaceAll, retainAll, sort, spliterator, toArray
-
Field Details
-
data
-
owner
-
-
Constructor Details
-
PersistedList
protected PersistedList() -
PersistedList
-
PersistedList
-
-
Method Details
-
setOwner
-
add
- Specified by:
add
in interfaceCollection<T>
- Specified by:
add
in interfaceList<T>
- Overrides:
add
in classAbstractList<T>
-
addAll
- Specified by:
addAll
in interfaceCollection<T>
- Specified by:
addAll
in interfaceList<T>
- Overrides:
addAll
in classAbstractCollection<T>
-
replaceBy
- Throws:
IOException
-
get
-
get
-
getAll
Gets all instances that matches the given type. -
size
public int size()- Specified by:
size
in interfaceCollection<T>
- Specified by:
size
in interfaceList<T>
- Specified by:
size
in 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:
remove
in interfaceCollection<T>
- Specified by:
remove
in interfaceList<T>
- Overrides:
remove
in classAbstractCollection<T>
-
removeAll
- Throws:
IOException
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<T>
- Specified by:
clear
in interfaceList<T>
- Overrides:
clear
in 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 theDescribable
s in an array.- Specified by:
toArray
in interfaceCollection<T>
- Specified by:
toArray
in interfaceList<T>
- Overrides:
toArray
in classAbstractCollection<T>
-
addAllTo
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<T>
- Specified by:
isEmpty
in interfaceList<T>
- Overrides:
isEmpty
in classAbstractCollection<T>
-
contains
- Specified by:
contains
in interfaceCollection<T>
- Specified by:
contains
in interfaceList<T>
- Overrides:
contains
in classAbstractCollection<T>
-
toString
- Overrides:
toString
in classAbstractCollection<T>
-