E
- public final class SmallScalingOrderedSet<E> extends Object implements Set<E>
Set
which is implemented as a ArrayList
for a small Set.size()
and a LinkedHashSet
for a big Set.size()
.
This speeds up add(Object)
performance (in some cases by 20%) if most instances have a small size
because no Object.hashCode()
need to be calculated.
Modifier and Type | Field and Description |
---|---|
protected static int |
LIST_SIZE_THRESHOLD |
Constructor and Description |
---|
SmallScalingOrderedSet() |
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) |
boolean |
isEmpty() |
Iterator<E> |
iterator() |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
int |
size() |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals, hashCode, spliterator
parallelStream, removeIf, stream
protected static final int LIST_SIZE_THRESHOLD
public int size()
public boolean isEmpty()
public boolean contains(Object o)
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<E>
containsAll
in interface Set<E>
public Object[] toArray()
public <T> T[] toArray(T[] a)
public boolean add(E e)
public boolean addAll(Collection<? extends E> c)
public boolean remove(Object o)
public boolean retainAll(Collection<?> c)
public boolean removeAll(Collection<?> c)
Copyright © 2006–2019 JBoss by Red Hat. All rights reserved.