| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private final T | |
| private final T | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | contains(Object obj)
Overrides org. Implements org. Returns |
| public void | each(Procedure<? super T> procedure)
Implements org. The procedure is executed for each element in the iterable. |
| public boolean | equals(Object o)
Overrides java. Implements org. Compares the specified object with this set for equality. |
| 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 | getFirst()
Implements org. Returns the first element of an iterable. |
| public T | getLast()
Implements org. Returns the last element of an iterable. |
| public T | getOnly()
Overrides default org. Returns the element if the iterable has exactly one element. |
| public int | hashCode()
Overrides java. Implements org. Returns the hash code value for this set. |
| public Iterator | iterator()
Implements java. Returns an iterator over the elements in this set. |
| public ImmutableSet | newWith(T element)
Overrides org. Implements org. This method is similar to the |
| public ImmutableSet | newWithout(T element)
Overrides org. Implements org. This method is similar to the |
| public int | size()
Implements org. Returns the number of elements in this set (its cardinality). |
| private Object |
| element1 | back to summary |
|---|---|
| private final T element1 | |
| element2 | back to summary |
|---|---|
| private final T element2 | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| ImmutableDoubletonSet | back to summary |
|---|---|
| pack-priv ImmutableDoubletonSet(T obj1, T obj2) | |
| contains | back to summary |
|---|---|
| public boolean contains(Object obj) Overrides org. Implements org. Doc from java. Returns
| |
| each | back to summary |
|---|---|
| public void each(Procedure<? super T> procedure) 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..
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Implements org. Doc from java. Compares the specified object with this set for equality. Returns
| |
| 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());
}
});
| |
| getFirst | back to summary |
|---|---|
| public T getFirst() Implements org. Doc from org. Returns the first element of an iterable. In the case of a List it is the element at the first index. In the case of any other Collection, it is the first element that would be returned during an iteration. If the iterable is empty, null is returned. If null is a valid element of the container, then a developer would need to check to see if the iterable is empty to validate that a null result was not due to the container being empty. The order of Sets are not guaranteed (except for TreeSets and other Ordered Set implementations), so if you use this method, the first element could be any element from the Set.
| |
| getLast | back to summary |
|---|---|
| public T getLast() Implements org. Doc from org. Returns the last element of an iterable. In the case of a List it is the element at the last index. In the case of any other Collection, it is the last element that would be returned during an iteration. If the iterable is empty, null is returned. If null is a valid element of the container, then a developer would need to check to see if the iterable is empty to validate that a null result was not due to the container being empty. The order of Sets are not guaranteed (except for TreeSets and other Ordered Set implementations), so if you use this method, the last element could be any element from the Set.
| |
| 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
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Implements org. Doc from java. Returns the hash code value for this set. The hash code of a set is
defined to be the sum of the hash codes of the elements in the set,
where the hash code of a
| |
| iterator | back to summary |
|---|---|
| public Iterator Implements java. Doc from java. Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee).
| |
| newWith | back to summary |
|---|---|
| public ImmutableSet Overrides org. Implements org. Doc from org. This method is similar to the
| |
| newWithout | back to summary |
|---|---|
| public ImmutableSet Overrides org. Implements org. Doc from org. This method is similar to the
| |
| size | back to summary |
|---|---|
| public int size() Implements org. Doc from java. Returns the number of elements in this set (its cardinality). If this
set contains more than
| |
| writeReplace | back to summary |
|---|---|
| private Object writeReplace() | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| protected T | getElement(int i)
Implements abstract org.
|
| DoubletonSetIterator | back to summary |
|---|---|
| private DoubletonSetIterator() | |
| getElement | back to summary |
|---|---|
| protected T getElement(int i) Implements abstract org.
| |