org.apache.ignite.util.deque

## Class FastSizeDeque<E>

- java.lang.Object
- - org.apache.ignite.util.deque.FastSizeDeque<E>

Type Parameters:
  `E` - Deque element type

All Implemented Interfaces:
  Iterable<E>, Collection<E>, Deque<E>, Queue<E>

    public class FastSizeDeque<E>
    extends Object
    implements Deque<E>

`Deque` decorator that uses `LongAdder` for faster size computation.

Implementation is thread-safe if underlying `Deque` is thread-safe.

### Constructor Summary

Constructors
Constructor and Description
`FastSizeDeque(Deque<E> deque)` Creates a decorator.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `add(E e)`
`boolean` `addAll(Collection<? extends E> col)` Adds all of the elements in the specified collection at the end of this deque.
`void` `addFirst(E e)`
`void` `addLast(E e)`
`void` `clear()`
`boolean` `contains(Object o)`
`boolean` `containsAll(Collection<?> col)`
`Iterator<E>` `descendingIterator()`
`E` `element()`
`E` `getFirst()`
`E` `getLast()`
`boolean` `isEmpty()`
`boolean` `isEmptyx()` Tests this deque for emptiness.; equivalent to `sizex() == 0`.
`Iterator<E>` `iterator()`
`boolean` `offer(E e)`
`boolean` `offerFirst(E e)`
`boolean` `offerLast(E e)`
`E` `peek()`
`E` `peekFirst()`
`E` `peekLast()`
`E` `poll()`
`E` `pollFirst()`
`E` `pollLast()`
`E` `pop()`
`void` `push(E e)`
`E` `remove()`
`boolean` `remove(Object o)`
`boolean` `removeAll(Collection<?> col)`
`E` `removeFirst()`
`boolean` `removeFirstOccurrence(Object o)`
`boolean` `removeIf(Predicate<? super E> pred)`
`E` `removeLast()`
`boolean` `removeLastOccurrence(Object o)`
`boolean` `retainAll(Collection<?> col)`
`int` `size()`
`int` `sizex()` Fast size getter.
`Object[]` `toArray()`
`<T> T[]` `toArray(T[] ts)`

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

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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

`equals, hashCode, parallelStream, spliterator, stream`

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

`forEach`

### Constructor Detail

#### FastSizeDeque

    public FastSizeDeque(Deque<E> deque)

Creates a decorator.

Parameters:
  `deque` - Deque being decorated.

### Method Detail

#### sizex

    public int sizex()

Fast size getter.

Returns:
  Deque size.

#### isEmptyx

    public boolean isEmptyx()

Tests this deque for emptiness.; equivalent to `sizex() == 0`.

Returns:
  `True` if this deque is empty.

#### addFirst

    public void addFirst(E e)

Specified by:
  `addFirst` in interface `Deque<E>`

#### addLast

    public void addLast(E e)

Specified by:
  `addLast` in interface `Deque<E>`

#### offerFirst

    public boolean offerFirst(E e)

Specified by:
  `offerFirst` in interface `Deque<E>`

#### offerLast

    public boolean offerLast(E e)

Specified by:
  `offerLast` in interface `Deque<E>`

#### removeFirst

    public E removeFirst()

Specified by:
  `removeFirst` in interface `Deque<E>`

#### removeLast

    public E removeLast()

Specified by:
  `removeLast` in interface `Deque<E>`

#### pollFirst

    public E pollFirst()

Specified by:
  `pollFirst` in interface `Deque<E>`

#### pollLast

    public E pollLast()

Specified by:
  `pollLast` in interface `Deque<E>`

#### getFirst

    public E getFirst()

Specified by:
  `getFirst` in interface `Deque<E>`

#### getLast

    public E getLast()

Specified by:
  `getLast` in interface `Deque<E>`

#### peekFirst

    public E peekFirst()

Specified by:
  `peekFirst` in interface `Deque<E>`

#### peekLast

    public E peekLast()

Specified by:
  `peekLast` in interface `Deque<E>`

#### removeFirstOccurrence

    public boolean removeFirstOccurrence(Object o)

Specified by:
  `removeFirstOccurrence` in interface `Deque<E>`

#### removeLastOccurrence

    public boolean removeLastOccurrence(Object o)

Specified by:
  `removeLastOccurrence` in interface `Deque<E>`

#### add

    public boolean add(E e)

Specified by:
  `add` in interface `Collection<E>`
Specified by:
  `add` in interface `Deque<E>`
Specified by:
  `add` in interface `Queue<E>`

#### offer

    public boolean offer(E e)

Specified by:
  `offer` in interface `Deque<E>`
Specified by:
  `offer` in interface `Queue<E>`

#### remove

    public E remove()

Specified by:
  `remove` in interface `Deque<E>`
Specified by:
  `remove` in interface `Queue<E>`

#### poll

    public E poll()

Specified by:
  `poll` in interface `Deque<E>`
Specified by:
  `poll` in interface `Queue<E>`

#### element

    public E element()

Specified by:
  `element` in interface `Deque<E>`
Specified by:
  `element` in interface `Queue<E>`

#### peek

    public E peek()

Specified by:
  `peek` in interface `Deque<E>`
Specified by:
  `peek` in interface `Queue<E>`

#### push

    public void push(E e)

Specified by:
  `push` in interface `Deque<E>`

#### pop

    public E pop()

Specified by:
  `pop` in interface `Deque<E>`

#### remove

    public boolean remove(Object o)

Specified by:
  `remove` in interface `Collection<E>`
Specified by:
  `remove` in interface `Deque<E>`

#### containsAll

    public boolean containsAll(@NotNull
                               Collection<?> col)

Specified by:
  `containsAll` in interface `Collection<E>`

#### addAll

    public boolean addAll(@NotNull
                          Collection<? extends E> col)

Adds all of the elements in the specified collection at the end of this deque.

Note: If collection being added can mutate concurrently, or underlying deque implementation allows partial insertion, then subsequent calls to `size()` can report incorrect value.

Specified by:
  `addAll` in interface `Collection<E>`
Parameters:
  `col` - The elements to be inserted into this deque.
Returns:
  `true` if this deque changed as a result of the call.

#### removeAll

    public boolean removeAll(@NotNull
                             Collection<?> col)

Specified by:
  `removeAll` in interface `Collection<E>`

#### removeIf

    public boolean removeIf(Predicate<? super E> pred)

Specified by:
  `removeIf` in interface `Collection<E>`

#### retainAll

    public boolean retainAll(@NotNull
                             Collection<?> col)

Specified by:
  `retainAll` in interface `Collection<E>`

#### clear

    public void clear()

Specified by:
  `clear` in interface `Collection<E>`

#### contains

    public boolean contains(Object o)

Specified by:
  `contains` in interface `Collection<E>`
Specified by:
  `contains` in interface `Deque<E>`

#### size

    public int size()

Specified by:
  `size` in interface `Collection<E>`
Specified by:
  `size` in interface `Deque<E>`

#### isEmpty

    public boolean isEmpty()

Specified by:
  `isEmpty` in interface `Collection<E>`

#### iterator

    @NotNull
    public Iterator<E> iterator()

Specified by:
  `iterator` in interface `Iterable<E>`
Specified by:
  `iterator` in interface `Collection<E>`
Specified by:
  `iterator` in interface `Deque<E>`

#### toArray

    @NotNull
    public Object[] toArray()

Specified by:
  `toArray` in interface `Collection<E>`

#### toArray

    @NotNull
    public <T> T[] toArray(@NotNull
                                    T[] ts)

Specified by:
  `toArray` in interface `Collection<E>`

#### descendingIterator

    @NotNull
    public Iterator<E> descendingIterator()

Specified by:
  `descendingIterator` in interface `Deque<E>`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.7.6
Release Date | : September 11 2019