Package aQute.lib.unmodifiable
Class ImmutableSet<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- aQute.lib.unmodifiable.ImmutableSet<E>
-
- All Implemented Interfaces:
java.lang.Iterable<E>,java.util.Collection<E>,java.util.Set<E>
final class ImmutableSet<E> extends java.util.AbstractSet<E> implements java.util.Set<E>
-
-
Field Summary
Fields Modifier and Type Field Description (package private) E[]elements(package private) static ImmutableSet<?>EMPTY(package private) int[]hash_bucket
-
Constructor Summary
Constructors Constructor Description ImmutableSet(E... elements)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(E e)booleanaddAll(java.util.Collection<? extends E> collection)voidclear()booleancontains(java.lang.Object o)booleanequals(java.lang.Object o)private static <E> int[]hash(E[] elements)inthashCode()java.util.Iterator<E>iterator()private static <E> intlinear_probe(E[] elements, int[] hash_bucket, java.lang.Object e)private intlinear_probe(java.lang.Object e)booleanremove(java.lang.Object o)booleanremoveAll(java.util.Collection<?> collection)booleanremoveIf(java.util.function.Predicate<? super E> filter)booleanretainAll(java.util.Collection<?> collection)intsize()java.lang.Object[]toArray()<T> T[]toArray(T[] array)
-
-
-
Field Detail
-
EMPTY
static final ImmutableSet<?> EMPTY
-
elements
final E[] elements
-
hash_bucket
final int[] hash_bucket
-
-
Constructor Detail
-
ImmutableSet
@SafeVarargs ImmutableSet(E... elements)
-
-
Method Detail
-
hash
private static <E> int[] hash(E[] elements)
-
linear_probe
private static <E> int linear_probe(E[] elements, int[] hash_bucket, java.lang.Object e)
-
linear_probe
private int linear_probe(java.lang.Object e)
-
iterator
public java.util.Iterator<E> iterator()
-
size
public int size()
-
contains
public boolean contains(java.lang.Object o)
-
toArray
public java.lang.Object[] toArray()
-
toArray
public <T> T[] toArray(T[] array)
-
equals
public boolean equals(java.lang.Object o)
-
hashCode
public int hashCode()
-
add
public boolean add(E e)
-
remove
public boolean remove(java.lang.Object o)
-
addAll
public boolean addAll(java.util.Collection<? extends E> collection)
-
removeAll
public boolean removeAll(java.util.Collection<?> collection)
-
retainAll
public boolean retainAll(java.util.Collection<?> collection)
-
clear
public void clear()
-
-