E - the type of the Set's elements.public final class ImmutableSet<E> extends AbstractSet<E> implements Serializable
Set. This implementation provides a predictable iteration
order by remembering the order in which elements were inserted into the
Set (insertion-order). Note that insertion order is not affected if
an element is re-inserted into the Set. Accepts null values.| Modifier and Type | Class and Description |
|---|---|
static class |
ImmutableSet.Builder<E>
ImmutableSet builder. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E e) |
boolean |
addAll(Collection<? extends E> c) |
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
static <E> Set<E> |
copyOf(Collection<? extends E> c)
Creates a new
ImmutableSet from the given Collection. |
static <E> Set<E> |
copyOf(E[] values)
Creates a new
ImmutableSet containing the given elements. |
static <E> Set<E> |
copyOf(Iterable<? extends E> i)
Creates a new
ImmutableSet from the given Iterable. |
static <E> Set<E> |
copyOf(Iterator<? extends E> i)
Creates a new
ImmutableSet from the given Iterator. |
boolean |
isEmpty() |
Iterator<E> |
iterator() |
static <E> Set<E> |
of(E... values)
Creates a new
ImmutableSet containing the given elements. |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
int |
size() |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
equals, hashCodetoStringpublic static <E> Set<E> copyOf(Collection<? extends E> c)
ImmutableSet from the given Collection.E - the type of the Set's elements.c - the source Collection.ImmutableSet.NullPointerException - if c is null.public static <E> Set<E> copyOf(Iterable<? extends E> i)
ImmutableSet from the given Iterable.E - the type of the Set's elements.i - the source Iterable.ImmutableSet.NullPointerException - if i is null.public static <E> Set<E> copyOf(Iterator<? extends E> i)
ImmutableSet from the given Iterator.E - the type of the Set's elements.i - the source Iterator.ImmutableSet.NullPointerException - if i is null.public static <E> Set<E> copyOf(E[] values)
ImmutableSet containing the given elements.E - the type of the Set's elements.values - the Set's elements.ImmutableSet.NullPointerException - if values is null.public static <E> Set<E> of(E... values)
ImmutableSet containing the given elements.E - the type of the Set's elements.values - the Set's elements.ImmutableSet.NullPointerException - if values is null.public int size()
size in interface Collection<E>size in interface Set<E>size in class AbstractCollection<E>public boolean isEmpty()
isEmpty in interface Collection<E>isEmpty in interface Set<E>isEmpty in class AbstractCollection<E>public boolean contains(Object o)
contains in interface Collection<E>contains in interface Set<E>contains in class AbstractCollection<E>public Object[] toArray()
toArray in interface Collection<E>toArray in interface Set<E>toArray in class AbstractCollection<E>public <T> T[] toArray(T[] a)
toArray in interface Collection<E>toArray in interface Set<E>toArray in class AbstractCollection<E>public boolean add(E e)
add in interface Collection<E>add in interface Set<E>add in class AbstractCollection<E>public boolean remove(Object o)
remove in interface Collection<E>remove in interface Set<E>remove in class AbstractCollection<E>public boolean containsAll(Collection<?> c)
containsAll in interface Collection<E>containsAll in interface Set<E>containsAll in class AbstractCollection<E>public boolean addAll(Collection<? extends E> c)
addAll in interface Collection<E>addAll in interface Set<E>addAll in class AbstractCollection<E>public boolean retainAll(Collection<?> c)
retainAll in interface Collection<E>retainAll in interface Set<E>retainAll in class AbstractCollection<E>public boolean removeAll(Collection<?> c)
removeAll in interface Collection<E>removeAll in interface Set<E>removeAll in class AbstractSet<E>public void clear()
clear in interface Collection<E>clear in interface Set<E>clear in class AbstractCollection<E>Copyright © 2012–2015. All rights reserved.