public class LabeledList extends FixedSizeList
| Constructor and Description |
|---|
LabeledList(int size) |
LabeledList(LabeledList old)
Constructs a new instance that is a copy of the old instance.
|
| Modifier and Type | Method and Description |
|---|---|
int[] |
getLabelsInOrder()
Gets an array containing all of the labels used in this instance,
in order.
|
int |
getMaxLabel()
Gets the maximum label (exclusive) of any block added to this instance.
|
int |
indexOfLabel(int label)
Gets the index of the first item in the list with the given
label, if any.
|
protected void |
set(int n,
LabeledItem item)
Sets the element at the given index.
|
void |
shrinkToFit()
Shrinks this instance to fit, by removing any unset
(
null) elements, leaving the remaining elements in
their original order. |
equals, get0, getOrNull0, hashCode, set0, size, toHuman, toHuman, toString, toStringisImmutable, isMutable, setImmutable, throwIfImmutable, throwIfMutablepublic LabeledList(int size)
public LabeledList(LabeledList old)
old - instance to copypublic final int getMaxLabel()
>= 0; the maximum labelpublic final int indexOfLabel(int label)
label - >= 0; the label to look for>= -1; the index of the so-labelled item, or -1
if none is foundpublic final int[] getLabelsInOrder()
non-null; ordered array of labelsjava.lang.NullPointerException - thrown if there are any null
items in this instancepublic void shrinkToFit()
null) elements, leaving the remaining elements in
their original order.shrinkToFit in class FixedSizeListprotected void set(int n,
LabeledItem item)
n - >= 0, < size(); which elementitem - null-ok; the value to storeCopyright © 2020. All Rights Reserved.