Package com.oorian.html
Class Elements
java.lang.Object
com.oorian.html.Elements
- All Implemented Interfaces:
Iterable<Element>,Collection<Element>,List<Element>,SequencedCollection<Element>
A thread-safe collection class for managing HTML elements.
Elements provides a synchronized list implementation specifically designed for storing and managing
Element objects. This class wraps a thread-safe list to ensure safe concurrent access in
multi-threaded environments such as web applications.
Features:
- Thread-safe list implementation using synchronized collections
- Full List interface implementation for standard collection operations
- Copy constructor for creating independent copies of element collections
- Type-safe storage specifically for Element objects
Usage:
Elements elements = new Elements();
elements.add(new Div());
elements.add(new Paragraph("Hello"));
// Create a copy
Elements copy = elements.getCopy();
- Since:
- 2007
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanbooleanaddAll(int index, Collection<? extends Element> c) final booleanaddAll(Collection<? extends Element> c) voidclear()booleanbooleancontainsAll(Collection<?> c) get(int index) getCopy()Creates and returns an independent copy of this Elements collection.intbooleanisEmpty()iterator()intlistIterator(int index) remove(int index) booleanbooleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) intsize()subList(int fromIndex, int toIndex) Object[]toArray()<T> T[]toArray(T[] a) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
addFirst, addLast, equals, getFirst, getLast, hashCode, removeFirst, removeLast, replaceAll, reversed, sort, spliterator
-
Constructor Details
-
Elements
public Elements()Constructs an empty Elements collection. -
Elements
Copy constructor that creates a new Elements collection with all elements from the source.- Parameters:
elements- The source Elements collection to copy from.
-
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
contains
-
iterator
-
toArray
-
toArray
public <T> T[] toArray(T[] a) -
add
-
remove
-
containsAll
- Specified by:
containsAllin interfaceCollection<Element>- Specified by:
containsAllin interfaceList<Element>
-
addAll
-
addAll
-
removeAll
-
retainAll
-
clear
public void clear() -
get
-
set
-
add
-
remove
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<Element>
-
listIterator
- Specified by:
listIteratorin interfaceList<Element>
-
listIterator
- Specified by:
listIteratorin interfaceList<Element>
-
subList
-
getCopy
Creates and returns an independent copy of this Elements collection.- Returns:
- A new Elements instance containing all elements from this collection.
-