ElementType - type of elements added to the listpublic class XMLObjectChildrenList<ElementType extends XMLObject> extends AbstractList<ElementType>
| Modifier and Type | Field and Description |
|---|---|
private List<ElementType> |
elements
List of elements.
|
private XMLObject |
parent
Parent to the elements in this list.
|
modCount| Constructor and Description |
|---|
XMLObjectChildrenList(XMLObject newParent)
Constructs an empty list with all added XMLObjects being assigned the given parent XMLObject.
|
XMLObjectChildrenList(XMLObject newParent,
Collection<ElementType> newElements)
Constructs a list containing the elements in the specified collection, in the order they are returned by the
collection's iterator, with each added XMLObject assigned the given parent XMLObject.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
ElementType element)
Adds the given XMLObject to this list.
|
boolean |
contains(ElementType element)
Checks to see if the given element is contained in this list.
|
ElementType |
get(int index) |
boolean |
remove(ElementType element)
Removes the element from the list.
|
ElementType |
remove(int index) |
ElementType |
set(int index,
ElementType element)
Replaces the XMLObject at the specified index with the given element.
|
protected void |
setParent(ElementType element)
Assigned the parent, given at list construction, to the given element if the element does not have a parent or
its parent matches the one given at list construction time.
|
int |
size() |
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subListaddAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringprivate final XMLObject parent
private final List<ElementType extends XMLObject> elements
public XMLObjectChildrenList(@Nonnull XMLObject newParent)
newParent - the parent for all the added XMLObjectspublic XMLObjectChildrenList(@Nonnull XMLObject newParent, @Nonnull Collection<ElementType> newElements)
An IllegalArgumentException is thrown if any of the XMLObjects in the given collection already have a parent other than the given parent
newParent - the parent for all the added XMLObjectsnewElements - the elements to be addedpublic int size()
size in interface Collection<ElementType extends XMLObject>size in interface List<ElementType extends XMLObject>size in class AbstractCollection<ElementType extends XMLObject>public boolean contains(@Nonnull ElementType element)
element - the element to check for@Nonnull public ElementType get(int index)
get in interface List<ElementType extends XMLObject>get in class AbstractList<ElementType extends XMLObject>@Nullable public ElementType set(int index, @Nullable ElementType element)
An IllegalArgumentException is thrown if the given XMLObject already has a parent other than the parent given at list construction time.
set in interface List<ElementType extends XMLObject>set in class AbstractList<ElementType extends XMLObject>index - index of the XMLObject to be replacedelement - element to be stored at the given indexpublic void add(int index,
@Nullable
ElementType element)
An IllegalArgumentException is thrown if the given XMLObject already has a parent other than the parent given at list construction time.
add in interface List<ElementType extends XMLObject>add in class AbstractList<ElementType extends XMLObject>index - index at which to add the given XMLObjectelement - element to be stored at the given index@Nonnull public ElementType remove(int index)
remove in interface List<ElementType extends XMLObject>remove in class AbstractList<ElementType extends XMLObject>public boolean remove(@Nullable ElementType element)
element - the element to be removedprotected void setParent(@Nonnull ElementType element)
An IllegalArgumentException is thrown if the given XMLObject already has a parent other than the parent given at list construction time.
element - the element to set the parent onCopyright © 1999–2014. All rights reserved.