public class NodeList extends Object implements List, Cloneable
toString()
method that will output the XML serialized form of the
nodes it contains - again focusing on template engine usage, as well as the
selectNodes(String)
method that helps selecting a different set of nodes
starting from the nodes in this list. The class also implements the List
interface by simply delegating calls to the contained list (the subList(int, int)
method is implemented by delegating to the contained list and wrapping the returned
sublist into a NodeList
).Constructor and Description |
---|
NodeList()
Creates an empty node list.
|
NodeList(org.jdom.Document document)
Creates a node list that holds a single
Document node. |
NodeList(org.jdom.Element element)
Creates a node list that holds a single
Element node. |
NodeList(List nodes)
Creates a node list that holds a list of nodes.
|
NodeList(List nodes,
boolean copy)
Creates a node list that holds a list of nodes.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
Object o) |
boolean |
add(Object o) |
boolean |
addAll(Collection c) |
boolean |
addAll(int index,
Collection c) |
void |
clear() |
Object |
clone()
Returns a NodeList that contains the same nodes as this node list.
|
boolean |
contains(Object o) |
boolean |
containsAll(Collection c) |
boolean |
equals(Object o)
Tests for equality with another object.
|
Object |
get(int index) |
List |
getList()
Retrieves the underlying list used to store the nodes.
|
int |
hashCode()
Returns the hash code of the contained list.
|
int |
indexOf(Object o) |
boolean |
isEmpty() |
Iterator |
iterator() |
int |
lastIndexOf(Object o) |
ListIterator |
listIterator() |
ListIterator |
listIterator(int index) |
Object |
remove(int index) |
boolean |
remove(Object o) |
boolean |
removeAll(Collection c) |
boolean |
retainAll(Collection c) |
NodeList |
selectNodes(String xpathString)
Applies an XPath expression to the node list and returns the resulting
node list.
|
Object |
set(int index,
Object o) |
int |
size() |
List |
subList(int fromIndex,
int toIndex) |
Object[] |
toArray() |
Object[] |
toArray(Object[] a) |
String |
toString()
This method returns the string resulting from concatenation of string
representations of its nodes.
|
finalize, getClass, notify, notifyAll, wait, wait, wait
replaceAll, sort, spliterator
parallelStream, removeIf, stream
public NodeList()
public NodeList(org.jdom.Document document)
Document
node.document
- public NodeList(org.jdom.Element element)
Element
node.element
- public NodeList(List nodes)
nodes
- the list of nodes this template should hold. The created
template will copy the passed nodes list, so changes to the passed list
will not affect the model.public NodeList(List nodes, boolean copy)
nodes
- the list of nodes this template should hold.copy
- if true, the created template will copy the passed nodes
list, so changes to the passed list will not affect the model. If false,
the model will reference the passed list and will sense changes in it,
altough no operations on the list will be synchronized.public List getList()
List
interface
of this class itself. You would probably access the underlying list only for
synchronization purposes.public String toString()
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
- if the contained list's class does
not have an accessible no-arg constructor.public int hashCode()
public boolean equals(Object o)
public NodeList selectNodes(String xpathString)
xpathString
- the XPath expression you wish to applypublic boolean add(Object o)
add
in interface Collection
add
in interface List
List.add(java.lang.Object)
public void add(int index, Object o)
add
in interface List
List.add(int, java.lang.Object)
public boolean addAll(Collection c)
addAll
in interface Collection
addAll
in interface List
List.addAll(java.util.Collection)
public boolean addAll(int index, Collection c)
addAll
in interface List
List.addAll(int, java.util.Collection)
public void clear()
clear
in interface Collection
clear
in interface List
List.clear()
public boolean contains(Object o)
contains
in interface Collection
contains
in interface List
List.contains(java.lang.Object)
public boolean containsAll(Collection c)
containsAll
in interface Collection
containsAll
in interface List
List.containsAll(java.util.Collection)
public Object get(int index)
get
in interface List
List.get(int)
public int indexOf(Object o)
indexOf
in interface List
List.indexOf(java.lang.Object)
public boolean isEmpty()
isEmpty
in interface Collection
isEmpty
in interface List
List.isEmpty()
public Iterator iterator()
iterator
in interface Iterable
iterator
in interface Collection
iterator
in interface List
List.iterator()
public int lastIndexOf(Object o)
lastIndexOf
in interface List
List.lastIndexOf(java.lang.Object)
public ListIterator listIterator()
listIterator
in interface List
List.listIterator()
public ListIterator listIterator(int index)
listIterator
in interface List
List.listIterator(int)
public Object remove(int index)
remove
in interface List
List.remove(int)
public boolean remove(Object o)
remove
in interface Collection
remove
in interface List
List.remove(java.lang.Object)
public boolean removeAll(Collection c)
removeAll
in interface Collection
removeAll
in interface List
List.removeAll(java.util.Collection)
public boolean retainAll(Collection c)
retainAll
in interface Collection
retainAll
in interface List
List.retainAll(java.util.Collection)
public Object set(int index, Object o)
set
in interface List
List.set(int, java.lang.Object)
public int size()
size
in interface Collection
size
in interface List
List.size()
public List subList(int fromIndex, int toIndex)
subList
in interface List
List.subList(int, int)
public Object[] toArray()
toArray
in interface Collection
toArray
in interface List
List.toArray()
public Object[] toArray(Object[] a)
toArray
in interface Collection
toArray
in interface List
List.toArray(java.lang.Object[])
Copyright © 2000–2016. All rights reserved.