Package org.optaplanner.core.impl.util
Class ListBasedScalingOrderedSet<E>
java.lang.Object
org.optaplanner.core.impl.util.ListBasedScalingOrderedSet<E>
- Type Parameters:
 E-
- All Implemented Interfaces:
 Iterable<E>,Collection<E>,Set<E>
An ordered 
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.
- 
Field Summary
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanaddAll(Collection<? extends E> c) voidclear()booleanbooleancontainsAll(Collection<?> c) booleanisEmpty()iterator()booleanbooleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) intsize()Object[]toArray()<T> T[]toArray(T[] a) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
equals, hashCode, spliterator 
- 
Field Details
- 
LIST_SIZE_THRESHOLD
protected static final int LIST_SIZE_THRESHOLD- See Also:
 
 
 - 
 - 
Constructor Details
- 
ListBasedScalingOrderedSet
public ListBasedScalingOrderedSet() 
 - 
 - 
Method Details
- 
size
public int size() - 
isEmpty
public boolean isEmpty() - 
contains
 - 
containsAll
- Specified by:
 containsAllin interfaceCollection<E>- Specified by:
 containsAllin interfaceSet<E>
 - 
iterator
 - 
toArray
 - 
toArray
public <T> T[] toArray(T[] a)  - 
add
 - 
addAll
 - 
remove
 - 
retainAll
 - 
removeAll
 - 
clear
public void clear() 
 -