Package org.apache.groovy.json.internal
Class ValueList
List implementation that lazily converts overlay
Value instances on access.-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds a parsed element without forcing conversion.voidchopList()Chops every overlay-backed element currently stored in the list.voidclear()get(int index) Converts the indexed element on demand and optionally chops nested containers.iterator()Returns an iterator after materializing all pendingValueentries.list()Exposes the raw backing list used during lazy parsing.intsize()Methods inherited from class java.util.AbstractList
add, addAll, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subListMethods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
Constructor Details
-
ValueList
public ValueList(boolean lazyChop) Creates a lazy list wrapper.- Parameters:
lazyChop- whether nested values should be chopped when touched
-
-
Method Details
-
get
Converts the indexed element on demand and optionally chops nested containers. -
size
public int size()- Specified by:
sizein interfaceCollection<Object>- Specified by:
sizein interfaceList<Object>- Specified by:
sizein classAbstractCollection<Object>
-
iterator
Returns an iterator after materializing all pendingValueentries. -
clear
public void clear()- Specified by:
clearin interfaceCollection<Object>- Specified by:
clearin interfaceList<Object>- Overrides:
clearin classAbstractList<Object>
-
add
Adds a parsed element without forcing conversion.- Specified by:
addin interfaceCollection<Object>- Specified by:
addin interfaceList<Object>- Overrides:
addin classAbstractList<Object>- Parameters:
obj- element to append- Returns:
true
-
chopList
public void chopList()Chops every overlay-backed element currently stored in the list. -
list
Exposes the raw backing list used during lazy parsing.- Returns:
- the mutable backing list
-