| Modifier and Type | Field and Description |
|---|---|
| private T | |
| private T | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public DoubletonList | clone()
Overrides org. Implements org. Creates and returns a copy of this object. |
| public boolean | contains(Object obj)
Overrides org. Implements java. Returns |
| public void | each(Procedure<? super T> procedure)
Overrides org. Implements org. The procedure is executed for each element in the iterable. |
| public <P> void | forEachWith(Procedure2<? super T, ? super P> procedure, P parameter)
Overrides org. Implements org. The procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument. |
| public void | forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)
Overrides org. Implements org. Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure. |
| public T | get(int index)
Implements java. Returns the element at the specified position in this list. |
| public T | getFirst()
Overrides org. Overrides default org. Implements org. This default override exists because java.util.List added a default getFirst() method in Java 21. |
| public T | getLast()
Overrides org. Overrides default org. Implements org. This default override exists because java.util.List added a default getLast() method in Java 21. |
| public T | getOnly()
Overrides default org. Returns the element if the iterable has exactly one element. |
| public void | readExternal(ObjectInput in)
Implements java. The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. |
| public void | replaceAll(UnaryOperator<T> operator)
Overrides default java. Replaces each element of this list with the result of applying the operator to that element (optional operation). |
| public T | set(int index, T element)
Implements java. set is implemented purely to allow the List to be sorted, not because this List should be considered mutable. |
| public int | size()
Implements java. Returns the number of elements in this list. |
| public TripletonList | with(T value)
Overrides default org. Implements org. This method allows fixed size collections the ability to add elements to their existing elements. |
| public void | writeExternal(ObjectOutput out)
Implements java. The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays. |
| element1 | back to summary |
|---|---|
| private T element1 | |
| element2 | back to summary |
|---|---|
| private T element2 | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| DoubletonList | back to summary |
|---|---|
public DoubletonList()
| |
| DoubletonList | back to summary |
|---|---|
| pack-priv DoubletonList(T obj1, T obj2) | |
| clone | back to summary |
|---|---|
| public DoubletonList Overrides org. Implements org. Doc from java. Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by
| |
| contains | back to summary |
|---|---|
| public boolean contains(Object obj) Overrides org. Implements java. Doc from java. Returns
| |
| each | back to summary |
|---|---|
| public void each(Procedure<? super T> procedure) Overrides org. Implements org. Doc from org. The procedure is executed for each element in the iterable. Example using a Java 8 lambda expression: people.each(person -> LOGGER.info(person.getName()));This method is a variant of InternalIterable#forEach(Procedure)
that has a signature conflict with Iterable#forEach(java..
| |
| forEachWith | back to summary |
|---|---|
| public <P> void forEachWith(Procedure2<? super T, ? super P> procedure, P parameter) Overrides org. Implements org. Doc from org. The procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument. Example using a Java 8 lambda:
people.forEachWith((Person person, Person other) ->
{
if (person.isRelatedTo(other))
{
LOGGER.info(person.getName());
}
}, fred);
Example using an anonymous inner class:
people.forEachWith(new Procedure2<Person, Person>()
{
public void value(Person person, Person other)
{
if (person.isRelatedTo(other))
{
LOGGER.info(person.getName());
}
}
}, fred);
| |
| forEachWithIndex | back to summary |
|---|---|
| public void forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure) Overrides org. Implements org. Doc from org. Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure. Example using a Java 8 lambda:
people.forEachWithIndex((Person person, int index) -> LOGGER.info("Index: " + index + " person: " + person.getName()));
Example using an anonymous inner class:
people.forEachWithIndex(new ObjectIntProcedure<Person>()
{
public void value(Person person, int index)
{
LOGGER.info("Index: " + index + " person: " + person.getName());
}
});
| |
| get | back to summary |
|---|---|
| public T get(int index) Implements java. Doc from java. Returns the element at the specified position in this list.
| |
| getFirst | back to summary |
|---|---|
| public T getFirst() Overrides org. Overrides default org. Implements org. Doc from org. This default override exists because java.util.List added a default getFirst() method in Java 21.
| |
| getLast | back to summary |
|---|---|
| public T getLast() Overrides org. Overrides default org. Implements org. Doc from org. This default override exists because java.util.List added a default getLast() method in Java 21.
| |
| getOnly | back to summary |
|---|---|
| public T getOnly() Overrides default org. Doc from org. Returns the element if the iterable has exactly one element. Otherwise, throw
| |
| readExternal | back to summary |
|---|---|
| public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException Implements java. Doc from java. The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.
| |
| replaceAll | back to summary |
|---|---|
| public void replaceAll(UnaryOperator<T> operator) Overrides default java. Doc from java. Replaces each element of this list with the result of applying the operator to that element (optional operation). Errors or runtime exceptions thrown by the operator are relayed to the caller.
| |
| set | back to summary |
|---|---|
| public T set(int index, T element) Implements java. set is implemented purely to allow the List to be sorted, not because this List should be considered mutable.
| |
| size | back to summary |
|---|---|
| public int size() Implements java. Doc from java. Returns the number of elements in this list. If this list contains
more than
| |
| with | back to summary |
|---|---|
| public TripletonList Overrides default org. Implements org. Doc from org. This method allows fixed size collections the ability to add elements to their existing elements. A new instance
of
MutableCollection<String> list;
list = list.with("1");
list = list.with("2");
return list;
| |
| writeExternal | back to summary |
|---|---|
| public void writeExternal(ObjectOutput out) throws IOException Implements java. Doc from java. The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.
| |