Reusable Java library of general tools with minimal external dependencies.
For questions or support, please contact us:
Email: support@aoindustries.com
Phone: 1-800-519-9541
Phone: +1-251-607-9556
Web: https://www.aoindustries.com/contact
public class UnmodifiableArraySet<E> extends AbstractSet<E> implements Externalizable
An unmodifiable compact Set implementation that stores the elements in hashCode order.
The emphasis is to use as little heap space as possible - this is not a general-purpose
Set implementation.
This set does not support null values.
This set will generally operate at O(log n) due to binary search. In general, it will not be as fast as the O(1) behavior of HashSet. Here we give up speed to save space.
This set is not thread safe.
to properly sort objects before adding to the set,
Serialized Form| Constructor and Description |
|---|
UnmodifiableArraySet() |
UnmodifiableArraySet(Collection<E> elements)
Uses the provided elements collection, which must already be sorted in hashCode order and unique.
|
UnmodifiableArraySet(E... elements)
Uses the provided elements, which must already be sorted in hashCode order and unique.
|
| 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() |
void |
readExternal(ObjectInput in) |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
int |
size() |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
void |
writeExternal(ObjectOutput out) |
equals, hashCodetoStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitspliteratorparallelStream, removeIf, streampublic UnmodifiableArraySet(E... elements)
public UnmodifiableArraySet(Collection<E> elements)
public UnmodifiableArraySet()
public int size()
size in interface Collection<E>size in interface Set<E>size in class AbstractCollection<E>public boolean isEmpty()
isEmpty in interface Collection<E>isEmpty in interface Set<E>isEmpty in class AbstractCollection<E>public boolean contains(Object o)
contains in interface Collection<E>contains in interface Set<E>contains in class AbstractCollection<E>public Object[] toArray()
toArray in interface Collection<E>toArray in interface Set<E>toArray in class AbstractCollection<E>public <T> T[] toArray(T[] a)
toArray in interface Collection<E>toArray in interface Set<E>toArray in class AbstractCollection<E>public boolean add(E e)
add in interface Collection<E>add in interface Set<E>add in class AbstractCollection<E>public boolean remove(Object o)
remove in interface Collection<E>remove in interface Set<E>remove in class AbstractCollection<E>public boolean containsAll(Collection<?> c)
containsAll in interface Collection<E>containsAll in interface Set<E>containsAll in class AbstractCollection<E>public boolean addAll(Collection<? extends E> c)
addAll in interface Collection<E>addAll in interface Set<E>addAll in class AbstractCollection<E>public boolean retainAll(Collection<?> c)
retainAll in interface Collection<E>retainAll in interface Set<E>retainAll in class AbstractCollection<E>public boolean removeAll(Collection<?> c)
removeAll in interface Collection<E>removeAll in interface Set<E>removeAll in class AbstractSet<E>public void clear()
clear in interface Collection<E>clear in interface Set<E>clear in class AbstractCollection<E>public void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionCopyright © 2000–2016 AO Industries, Inc.. All rights reserved.