org.apache.ignite.internal.util

## Class GridBoundedConcurrentLinkedHashSet<E>

- java.lang.Object
- - java.util.AbstractCollection<E>
  - - java.util.AbstractSet<E>
    - - org.apache.ignite.internal.util.GridSerializableSet<E>
      - - org.apache.ignite.internal.util.GridSetWrapper<E>
        - - org.apache.ignite.internal.util.GridBoundedConcurrentLinkedHashSet<E>

All Implemented Interfaces:
  Serializable, Iterable<E>, Collection<E>, Set<E>

    public class GridBoundedConcurrentLinkedHashSet<E>
    extends GridSetWrapper<E>

Concurrent set with an upper bound. Once set reaches its maximum capacity, the eldest elements will be removed based on insertion or access order.

See Also:
  Serialized Form

### Field Summary

### Fields inherited from class org.apache.ignite.internal.util.GridSetWrapper

`map, VAL`

### Constructor Summary

Constructors
Constructor and Description
`GridBoundedConcurrentLinkedHashSet(int max)` Creates a new, empty set with specified order and default initial capacity (16), load factor (0.75) and concurrencyLevel (16).
`GridBoundedConcurrentLinkedHashSet(int max, int initCap)` Creates a new, empty set with the specified initial capacity, and with default load factor (0.75) and concurrencyLevel (16).
`GridBoundedConcurrentLinkedHashSet(int max, int initCap, float loadFactor)` Creates a new, empty set with the specified initial capacity and load factor and with the default concurrencyLevel (16).
`GridBoundedConcurrentLinkedHashSet(int max, int initCap, float loadFactor, int concurLvl)` Creates a new, empty set with the specified initial capacity, load factor and concurrency level.
`GridBoundedConcurrentLinkedHashSet(int max, int initCap, float loadFactor, int concurLvl, ConcurrentLinkedHashMap.QueuePolicy qPlc)` Creates a new, empty set with the specified initial capacity, load factor and concurrency level.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `add(E e)` Note that unlike regular add operation on a set, this method will only add the passed in element if it's not already present in set.
`E` `addx(E e)` Note that unlike regular add operation on a set, this method will only add the passed in element if it's not already present in set.
`int` `sizex()`
`String` `toString()`

### Methods inherited from class org.apache.ignite.internal.util.GridSetWrapper

`clear, contains, defaultValue, isEmpty, iterator, map, remove, size, toArray, toArray`

### Methods inherited from class java.util.AbstractSet

`equals, hashCode, removeAll`

### Methods inherited from class java.util.AbstractCollection

`addAll, containsAll, retainAll`

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

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

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

`addAll, containsAll, retainAll, spliterator`

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

`parallelStream, removeIf, stream`

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

`forEach`

### Constructor Detail

#### GridBoundedConcurrentLinkedHashSet

    public GridBoundedConcurrentLinkedHashSet(int max)

Creates a new, empty set with specified order and default initial capacity (16), load factor (0.75) and concurrencyLevel (16).

Parameters:
  `max` - Upper bound of this set.

#### GridBoundedConcurrentLinkedHashSet

    public GridBoundedConcurrentLinkedHashSet(int max,
                                              int initCap)

Creates a new, empty set with the specified initial capacity, and with default load factor (0.75) and concurrencyLevel (16).

Parameters:
  `max` - Upper bound of this set.
  `initCap` - the initial capacity. The implementation performs internal sizing to accommodate this many elements.
Throws:
  `IllegalArgumentException` - if the initial capacity of elements is negative.

#### GridBoundedConcurrentLinkedHashSet

    public GridBoundedConcurrentLinkedHashSet(int max,
                                              int initCap,
                                              float loadFactor)

Creates a new, empty set with the specified initial capacity and load factor and with the default concurrencyLevel (16).

Parameters:
  `max` - Upper bound of this set.
  `initCap` - The implementation performs internal sizing to accommodate this many elements.
  `loadFactor` - the load factor threshold, used to control resizing. Resizing may be performed when the average number of elements per bin exceeds this threshold.
Throws:
  `IllegalArgumentException` - if the initial capacity of elements is negative or the load factor is nonpositive.

#### GridBoundedConcurrentLinkedHashSet

    public GridBoundedConcurrentLinkedHashSet(int max,
                                              int initCap,
                                              float loadFactor,
                                              int concurLvl)

Creates a new, empty set with the specified initial capacity, load factor and concurrency level.

Parameters:
  `max` - Upper bound of this set.
  `initCap` - the initial capacity. The implementation performs internal sizing to accommodate this many elements.
  `loadFactor` - the load factor threshold, used to control resizing. Resizing may be performed when the average number of elements per bin exceeds this threshold.
  `concurLvl` - the estimated number of concurrently updating threads. The implementation performs internal sizing to try to accommodate this many threads.
Throws:
  `IllegalArgumentException` - if the initial capacity is negative or the load factor or concurLvl are nonpositive.

#### GridBoundedConcurrentLinkedHashSet

    public GridBoundedConcurrentLinkedHashSet(int max,
                                              int initCap,
                                              float loadFactor,
                                              int concurLvl,
                                              ConcurrentLinkedHashMap.QueuePolicy qPlc)

Creates a new, empty set with the specified initial capacity, load factor and concurrency level.

Parameters:
  `max` - Upper bound of this set.
  `initCap` - the initial capacity. The implementation performs internal sizing to accommodate this many elements.
  `loadFactor` - the load factor threshold, used to control resizing. Resizing may be performed when the average number of elements per bin exceeds this threshold.
  `concurLvl` - the estimated number of concurrently updating threads. The implementation performs internal sizing to try to accommodate this many threads.
  `qPlc` - Queue policy.
Throws:
  `IllegalArgumentException` - if the initial capacity is negative or the load factor or concurLvl are nonpositive.

### Method Detail

#### add

    public boolean add(E e)

Note that unlike regular add operation on a set, this method will only add the passed in element if it's not already present in set.

Specified by:
  `add` in interface `Collection<E>`
Specified by:
  `add` in interface `Set<E>`
Overrides:
  `add` in class `GridSetWrapper<E>`
Parameters:
  `e` - Element to add.
Returns:
  `True` if element was added.

#### addx

    @Nullable
    public E addx(E e)

Note that unlike regular add operation on a set, this method will only add the passed in element if it's not already present in set.

Parameters:
  `e` - Element to add.
Returns:
  Value previously present in set or `null` if set didn't have this value.

#### sizex

    public int sizex()

Returns:
  Size of the set

#### toString

    public String toString()

Overrides:
  `toString` in class `GridSetWrapper<E>`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.13.0
Release Date | : April 20 2022