public class SortedArraySet<T> extends AbstractSet<T>
Modifier and Type | Class and Description |
---|---|
(package private) class |
SortedArraySet.SetIterator |
Modifier and Type | Field and Description |
---|---|
private Comparator<T> |
comparator |
private T[] |
elements |
private int |
size |
Modifier | Constructor and Description |
---|---|
private |
SortedArraySet(int initialCapacity,
Comparator<T> comparator) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(T t) |
private void |
add(T object,
int index) |
T |
addAndGet(T object) |
private int |
binarySearch(T object) |
private static <T> T[] |
cast(Object[] array) |
void |
clear() |
boolean |
contains(Object object) |
static <T extends Comparable<T>> |
create(int initialCapacity) |
private void |
ensureCapacity(int minCapacity) |
boolean |
equals(Object object) |
T |
first() |
private T |
get(int index) |
private static int |
insertionPoint(int binarySearchResult) |
Iterator<T> |
iterator() |
private void |
remove(int index) |
boolean |
remove(Object object) |
int |
size() |
Object[] |
toArray() |
<U> U[] |
toArray(U[] u) |
hashCode, removeAll
addAll, containsAll, isEmpty, retainAll, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, containsAll, isEmpty, retainAll, spliterator
parallelStream, removeIf, stream
private final Comparator<T> comparator
private T[] elements
private int size
private SortedArraySet(int initialCapacity, Comparator<T> comparator)
public static <T extends Comparable<T>> SortedArraySet<T> create(int initialCapacity)
private static <T> T[] cast(Object[] array)
private int binarySearch(T object)
private static int insertionPoint(int binarySearchResult)
public boolean add(T t)
add
in interface Collection<T>
add
in interface Set<T>
add
in class AbstractCollection<T>
private void ensureCapacity(int minCapacity)
private void add(T object, int index)
private void remove(int index)
private T get(int index)
public boolean remove(Object object)
remove
in interface Collection<T>
remove
in interface Set<T>
remove
in class AbstractCollection<T>
public T first()
public boolean contains(Object object)
contains
in interface Collection<T>
contains
in interface Set<T>
contains
in class AbstractCollection<T>
public int size()
size
in interface Collection<T>
size
in interface Set<T>
size
in class AbstractCollection<T>
public Object[] toArray()
toArray
in interface Collection<T>
toArray
in interface Set<T>
toArray
in class AbstractCollection<T>
public <U> U[] toArray(U[] u)
toArray
in interface Collection<T>
toArray
in interface Set<T>
toArray
in class AbstractCollection<T>
public void clear()
clear
in interface Collection<T>
clear
in interface Set<T>
clear
in class AbstractCollection<T>
public boolean equals(Object object)
equals
in interface Collection<T>
equals
in interface Set<T>
equals
in class AbstractSet<T>