public class FixedSizeList extends MutabilityControl implements ToHuman
| Constructor and Description |
|---|
FixedSizeList(int size)
Constructs an instance.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object other) |
protected java.lang.Object |
get0(int n)
Gets the indicated element.
|
protected java.lang.Object |
getOrNull0(int n)
Gets the indicated element, allowing
nulls to be
returned. |
int |
hashCode() |
protected void |
set0(int n,
java.lang.Object obj)
Sets the element at the given index, but without doing any type
checks on the element.
|
void |
shrinkToFit()
Shrinks this instance to fit, by removing any unset
(
null) elements, leaving the remaining elements in
their original order. |
int |
size()
Gets the number of elements in this list.
|
java.lang.String |
toHuman()
Return the "human" string form of this instance.
|
java.lang.String |
toHuman(java.lang.String prefix,
java.lang.String separator,
java.lang.String suffix)
Gets a customized human string for this instance.
|
java.lang.String |
toString() |
java.lang.String |
toString(java.lang.String prefix,
java.lang.String separator,
java.lang.String suffix)
Gets a customized string form for this instance.
|
isImmutable, isMutable, setImmutable, throwIfImmutable, throwIfMutablepublic FixedSizeList(int size)
null.size - the size of the listpublic boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toHuman()
toString().
This method will only work if every element of the list
implements ToHuman.public java.lang.String toString(java.lang.String prefix,
java.lang.String separator,
java.lang.String suffix)
prefix - null-ok; prefix for the start of the resultseparator - null-ok; separator to insert between each itemsuffix - null-ok; suffix for the end of the resultnon-null; the custom stringpublic java.lang.String toHuman(java.lang.String prefix,
java.lang.String separator,
java.lang.String suffix)
ToHuman.prefix - null-ok; prefix for the start of the resultseparator - null-ok; separator to insert between each itemsuffix - null-ok; suffix for the end of the resultnon-null; the custom stringpublic final int size()
public void shrinkToFit()
null) elements, leaving the remaining elements in
their original order.protected final java.lang.Object get0(int n)
NullPointerException. This method is
protected so that subclasses may offer a safe type-checked
public interface to their clients.n - >= 0, < size(); which elementnon-null; the indicated elementprotected final java.lang.Object getOrNull0(int n)
nulls to be
returned. This method is protected so that subclasses may
(optionally) offer a safe type-checked public interface to
their clients.n - >= 0, < size(); which elementnull-ok; the indicated elementprotected final void set0(int n,
java.lang.Object obj)
n - >= 0, < size(); which elementobj - null-ok; the value to storeCopyright © 2020. All Rights Reserved.