|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.javimmutable.collections.tree_list.JImmutableTreeList<T>
T
- @Immutable public class JImmutableTreeList<T>
Implementation of PersistentRandomAccessList that uses a 2-3 tree for its implementation. Values are stored and traversed in the same order as they are added using add(). Performance is slower than PersistentLinkedList so if forward order and/or random access are not required using that class may be a better option. All operations should be O(logN).
Nested Class Summary | |
---|---|
static class |
JImmutableTreeList.Builder<T>
|
Method Summary | ||
---|---|---|
JImmutableTreeList<T> |
assign(int index,
T value)
Replaces the value at the specified index (which must be within current bounds of the list) with the new value. |
|
static
|
builder()
Creates a MutableBuilder instance for efficiently constructing JImmutableTreeLists. |
|
Cursor<T> |
cursor()
|
|
JImmutableTreeList<T> |
delete(int index)
Delete value at index (which must be within the current bounds of the list). |
|
JImmutableRandomAccessList<T> |
deleteAll()
|
|
JImmutableTreeList<T> |
deleteFirst()
Removes the first value from the list and reduces size by 1. |
|
JImmutableTreeList<T> |
deleteLast()
Removes the last value from the list and reduces size by 1. |
|
boolean |
equals(Object o)
|
|
T |
get(int index)
Retrieves the value at the specified index (which must be within the bounds of the list). |
|
List<T> |
getList()
Returns an unmodifiable List implementation backed by this list. |
|
int |
hashCode()
|
|
JImmutableTreeList<T> |
insert(int index,
T value)
Insert value at index (which must be within 0 to size). |
|
JImmutableTreeList<T> |
insert(Iterable<? extends T> values)
Adds the values to the end of the list in the same order they appear in the Iterable. |
|
JImmutableTreeList<T> |
insert(T value)
Adds a value to the end of the list. |
|
JImmutableTreeList<T> |
insertFirst(T value)
Adds a value to the front of the list. |
|
JImmutableTreeList<T> |
insertLast(T value)
Adds a value to the end of the list. |
|
boolean |
isEmpty()
|
|
Iterator<T> |
iterator()
|
|
static
|
of()
|
|
int |
size()
Retrieve the number of values available in the container. |
|
String |
toString()
|
|
void |
verifyDepthsMatch()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static <T> JImmutableTreeList<T> of()
public static <T> JImmutableTreeList.Builder<T> builder()
T
-
@Nonnull public JImmutableTreeList<T> insert(int index, @Nullable T value)
JImmutableRandomAccessList
insert
in interface JImmutableRandomAccessList<T>
@Nonnull public JImmutableTreeList<T> insert(@Nullable T value)
JImmutableRandomAccessList
insert
in interface Insertable<T>
insert
in interface JImmutableList<T>
insert
in interface JImmutableRandomAccessList<T>
@Nonnull public JImmutableTreeList<T> insert(@Nonnull Iterable<? extends T> values)
JImmutableList
insert
in interface JImmutableList<T>
@Nonnull public JImmutableTreeList<T> insertFirst(@Nullable T value)
JImmutableRandomAccessList
insertFirst
in interface JImmutableList<T>
insertFirst
in interface JImmutableRandomAccessList<T>
@Nonnull public JImmutableTreeList<T> insertLast(@Nullable T value)
JImmutableRandomAccessList
insertLast
in interface JImmutableList<T>
insertLast
in interface JImmutableRandomAccessList<T>
@Nonnull public JImmutableTreeList<T> deleteFirst()
JImmutableRandomAccessList
deleteFirst
in interface JImmutableList<T>
deleteFirst
in interface JImmutableRandomAccessList<T>
@Nonnull public JImmutableTreeList<T> deleteLast()
JImmutableRandomAccessList
deleteLast
in interface JImmutableList<T>
deleteLast
in interface JImmutableRandomAccessList<T>
@Nonnull public JImmutableTreeList<T> delete(int index)
JImmutableRandomAccessList
delete
in interface JImmutableRandomAccessList<T>
public T get(int index)
JImmutableList
get
in interface Indexed<T>
get
in interface JImmutableList<T>
@Nonnull public JImmutableTreeList<T> assign(int index, @Nullable T value)
JImmutableRandomAccessList
assign
in interface JImmutableList<T>
assign
in interface JImmutableRandomAccessList<T>
@Nonnull public List<T> getList()
JImmutableList
getList
in interface JImmutableList<T>
public boolean isEmpty()
isEmpty
in interface JImmutableList<T>
public int size()
Indexed
size
in interface Indexed<T>
size
in interface JImmutableList<T>
@Nonnull public JImmutableRandomAccessList<T> deleteAll()
deleteAll
in interface JImmutableList<T>
deleteAll
in interface JImmutableRandomAccessList<T>
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
public Iterator<T> iterator()
iterator
in interface Iterable<T>
@Nonnull public Cursor<T> cursor()
cursor
in interface Cursorable<T>
public void verifyDepthsMatch()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |