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 boolean
add(E e)
boolean
addAll(java.util.Collection<? extends E> collection)
void
clear()
boolean
contains(java.lang.Object o)
boolean
equals(java.lang.Object o)
private static <E> int[]
hash(E[] elements)
int
hashCode()
java.util.Iterator<E>
iterator()
private static <E> int
linear_probe(E[] elements, int[] hash_bucket, java.lang.Object e)
private int
linear_probe(java.lang.Object e)
boolean
remove(java.lang.Object o)
boolean
removeAll(java.util.Collection<?> collection)
boolean
removeIf(java.util.function.Predicate<? super E> filter)
boolean
retainAll(java.util.Collection<?> collection)
int
size()
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()
-
-