SortedArraySet (Apache CXF JavaDoc 4.1.0-SNAPSHOT API)
Description: declaration: package: org.apache.cxf.common.util, class: SortedArraySet

Package org.apache.cxf.common.util

# Class SortedArraySet<T>

java.lang.Object
org.apache.cxf.common.util.SortedArraySet<T>

Type Parameters:
  `T` -

All Implemented Interfaces:
  `Iterable<T>`, `Collection<T>`, `Set<T>`, `SortedSet<T>`

public final class SortedArraySet<T> extends Object implements SortedSet<T>
This class implements most of the `Set` interface, backed by a sorted Array. This makes iterators very fast, lookups are log(n), but adds are fairly expensive. This class is also threadsafe, but without synchronizations. Lookups and iterators will iterate over the state of the Set when the iterator was created. If no data is stored in the Set, it uses very little memory. The backing array is created on demand. This class is primarily useful for stuff that will be setup at startup, but then iterated over MANY times during runtime.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SortedArraySet()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `add(T o)`
  `boolean`
  `addAll(Collection<? extends T> c)`
  `void`
  `clear()`
  `Comparator<? super T>`
  `comparator()`
  `boolean`
  `contains(Object o)`
  `boolean`
  `containsAll(Collection<?> c)`
  `boolean`
  `equals(Object o)`
  `T`
  `first()`
  `int`
  `hashCode()`
  `SortedSet<T>`
  `headSet(T toElement)`
  `boolean`
  `isEmpty()`
  `Iterator<T>`
  `iterator()`
  `T`
  `last()`
  `boolean`
  `remove(Object o)`
  `boolean`
  `removeAll(Collection<?> c)`
  `boolean`
  `retainAll(Collection<?> c)`
  `int`
  `size()`
  `SortedSet<T>`
  `subSet(T fromElement, T toElement)`
  `SortedSet<T>`
  `tailSet(T fromElement)`
  `Object[]`
  `toArray()`
  `<X> X[]`
  `toArray(X[] a)`
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface java.util.Collection

  `parallelStream, removeIf, stream, toArray`

  ### Methods inherited from interface java.lang.Iterable

  `forEach`

  ### Methods inherited from interface java.util.SortedSet

  `spliterator`

- ## Constructor Details

  - ### SortedArraySet

    public SortedArraySet()

- ## Method Details

  - ### clear

    public void clear()
    Specified by:
      `clear` in interface `Collection<T>`
    Specified by:
      `clear` in interface `Set<T>`

  - ### isEmpty

    public boolean isEmpty()
    Specified by:
      `isEmpty` in interface `Collection<T>`
    Specified by:
      `isEmpty` in interface `Set<T>`

  - ### iterator

    public Iterator<T> iterator()
    Specified by:
      `iterator` in interface `Collection<T>`
    Specified by:
      `iterator` in interface `Iterable<T>`
    Specified by:
      `iterator` in interface `Set<T>`

  - ### size

    public int size()
    Specified by:
      `size` in interface `Collection<T>`
    Specified by:
      `size` in interface `Set<T>`

  - ### add

    public boolean add(T o)
    Specified by:
      `add` in interface `Collection<T>`
    Specified by:
      `add` in interface `Set<T>`

  - ### addAll

    public boolean addAll(Collection<? extends T> c)
    Specified by:
      `addAll` in interface `Collection<T>`
    Specified by:
      `addAll` in interface `Set<T>`

  - ### containsAll

    public boolean containsAll(Collection<?> c)
    Specified by:
      `containsAll` in interface `Collection<T>`
    Specified by:
      `containsAll` in interface `Set<T>`

  - ### contains

    public boolean contains(Object o)
    Specified by:
      `contains` in interface `Collection<T>`
    Specified by:
      `contains` in interface `Set<T>`

  - ### removeAll

    public boolean removeAll(Collection<?> c)
    Specified by:
      `removeAll` in interface `Collection<T>`
    Specified by:
      `removeAll` in interface `Set<T>`

  - ### retainAll

    public boolean retainAll(Collection<?> c)
    Specified by:
      `retainAll` in interface `Collection<T>`
    Specified by:
      `retainAll` in interface `Set<T>`

  - ### remove

    public boolean remove(Object o)
    Specified by:
      `remove` in interface `Collection<T>`
    Specified by:
      `remove` in interface `Set<T>`

  - ### toArray

    public Object[] toArray()
    Specified by:
      `toArray` in interface `Collection<T>`
    Specified by:
      `toArray` in interface `Set<T>`

  - ### toArray

    public <X> X[] toArray(X[] a)
    Specified by:
      `toArray` in interface `Collection<T>`
    Specified by:
      `toArray` in interface `Set<T>`

  - ### equals

    public boolean equals(Object o)
    Specified by:
      `equals` in interface `Collection<T>`
    Specified by:
      `equals` in interface `Set<T>`
    Overrides:
      `equals` in class `Object`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### hashCode

    public int hashCode()
    Specified by:
      `hashCode` in interface `Collection<T>`
    Specified by:
      `hashCode` in interface `Set<T>`
    Overrides:
      `hashCode` in class `Object`

  - ### comparator

    public Comparator<? super T> comparator()
    Specified by:
      `comparator` in interface `SortedSet<T>`

  - ### first

    public T first()
    Specified by:
      `first` in interface `SortedSet<T>`

  - ### last

    public T last()
    Specified by:
      `last` in interface `SortedSet<T>`

  - ### headSet

    public SortedSet<T> headSet(T toElement)
    Specified by:
      `headSet` in interface `SortedSet<T>`

  - ### subSet

    public SortedSet<T> subSet(T fromElement, T toElement)
    Specified by:
      `subSet` in interface `SortedSet<T>`

  - ### tailSet

    public SortedSet<T> tailSet(T fromElement)
    Specified by:
      `tailSet` in interface `SortedSet<T>`