Package net.sf.saxon.ma.parray
Class ImmList2<E>
java.lang.Object
net.sf.saxon.ma.parray.ImmList<E>
net.sf.saxon.ma.parray.ImmList2<E>
- Type Parameters:
E
- the type of the elements of the list
- All Implemented Interfaces:
Iterable<E>
Implementation of an immutable list of arbitrary length, implemented as a binary tree
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAppend an element at the end of the listappendList
(ImmList<E> members) Append multiple elements at the end of the listget
(int index) Get the element at a given indexInsert an element at a given positionboolean
isEmpty()
Ask if the list is emptyiterator()
Return a list containing the same elements as this list, but optimized for efficient accessremove
(int index) Remove the member at a given positionReplace the element at a given indexint
size()
Get the size of the listsubList
(int start, int end) Return a sub-sequence with a given start and end positionMethods inherited from class net.sf.saxon.ma.parray.ImmList
empty, fromList, head, outOfBounds, pair, singleton, tail
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ImmList2
-
-
Method Details
-
get
Description copied from class:ImmList
Get the element at a given index -
size
public int size()Description copied from class:ImmList
Get the size of the list -
isEmpty
public boolean isEmpty()Description copied from class:ImmList
Ask if the list is empty -
replace
Description copied from class:ImmList
Replace the element at a given index -
insert
Description copied from class:ImmList
Insert an element at a given position- Specified by:
insert
in classImmList<E>
- Parameters:
index
- the position (zero-based) for the insertion. The new element will be inserted before the existing element at this position. If the index is equal to the list size, the new element is inserted at the end.member
- the new member to be included in the new list- Returns:
- a new list, identical to the old except for the addition of one member
-
append
Description copied from class:ImmList
Append an element at the end of the list -
appendList
Description copied from class:ImmList
Append multiple elements at the end of the list- Specified by:
appendList
in classImmList<E>
- Parameters:
members
- the new members to be included in the new list- Returns:
- a new list, identical to the old except for the addition of new members
-
remove
Description copied from class:ImmList
Remove the member at a given position -
subList
Description copied from class:ImmList
Return a sub-sequence with a given start and end position- Specified by:
subList
in classImmList<E>
- Parameters:
start
- the zero-based index position of the first member to be extractedend
- the zero-based index position of the first member after the sub-sequence to be extracted- Returns:
- a new list containing the elements from the specified range of positions
-
iterator
-
rebalance
Description copied from class:ImmList
Return a list containing the same elements as this list, but optimized for efficient access
-