ElementType
- type of elements added to the listpublic class XMLObjectChildrenList<ElementType extends XMLObject> extends AbstractList<ElementType>
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, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
parallelStream, removeIf, stream
public XMLObjectChildrenList(XMLObject newParent) throws NullPointerException
newParent
- the parent for all the added XMLObjectsNullPointerException
- thrown if the parent is nullpublic XMLObjectChildrenList(XMLObject newParent, Collection<ElementType> newElements) throws NullPointerException
newParent
- the parent for all the added XMLObjectsnewElements
- the elements to be addedNullPointerException
- thrown if the parent is nullIllegalArgumentException
- thrown if any of the XMLObjects in the given collection already have a parent
that is different from the given parentpublic 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(ElementType element)
element
- the element to check forpublic ElementType get(int index)
get
in interface List<ElementType extends XMLObject>
get
in class AbstractList<ElementType extends XMLObject>
public ElementType set(int index, ElementType element) throws IllegalArgumentException
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 indexIllegalArgumentException
- thrown if the given XMLObject already has a parent that is different from the
XMLObject given at list construction timepublic void add(int index, ElementType element) throws IllegalArgumentException
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 indexIllegalArgumentException
- thrown if the given XMLObject already has a parent that is different from the
XMLObject given at list construction timepublic ElementType remove(int index)
remove
in interface List<ElementType extends XMLObject>
remove
in class AbstractList<ElementType extends XMLObject>
public boolean remove(ElementType element)
element
- the element to be removedprotected void setParent(ElementType element) throws IllegalArgumentException
element
- the element to set the parent onIllegalArgumentException
- thrown if the given element already has a parent and it is different than the
parent given at list construction timeCopyright © 1999–2015. All rights reserved.