org.apache.ignite

## Interface IgniteSet<T>

- All Superinterfaces:
    AutoCloseable, Closeable, Collection<T>, Iterable<T>, Set<T>

      public interface IgniteSet<T>
      extends Set<T>, Closeable

  Set implementation based on on In-Memory Data Grid.

  # Overview

  Cache set implements `Set` interface and provides all methods from collections. Note that all `Collection` methods in the set may throw `IgniteException` in case of failure or if set was removed.

  # Collocated vs Non-collocated

  Set items can be placed on one node or distributed throughout grid nodes (governed by `collocated` parameter). `Non-collocated` mode is provided only for partitioned caches. If `collocated` parameter is `true`, then all set items will be collocated on one node, otherwise items will be distributed through all grid nodes.
  See Also:
    `Ignite.set(String, org.apache.ignite.configuration.CollectionConfiguration)`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `add(T t)`
    `boolean` | `addAll(Collection<? extends T> c)`
    `<R> R` | `affinityCall(IgniteCallable<R> job)` Executes given job on collocated set on the node where the set is located (a.k.a. affinity co-location).
    `void` | `affinityRun(IgniteRunnable job)` Executes given job on collocated set on the node where the set is located (a.k.a. affinity co-location).
    `void` | `clear()`
    `void` | `close()` Removes this set.
    `boolean` | `collocated()` Returns `true` if this set can be kept on the one node only.
    `boolean` | `contains(Object o)`
    `boolean` | `containsAll(Collection<?> c)`
    `boolean` | `isEmpty()`
    `Iterator<T>` | `iterator()`
    `String` | `name()` Gets set name.
    `boolean` | `remove(Object o)`
    `boolean` | `removeAll(Collection<?> c)`
    `boolean` | `removed()` Gets status of set.
    `boolean` | `retainAll(Collection<?> c)`
    `int` | `size()`
    `Object[]` | `toArray()`
    `<T1> T1[]` | `toArray(T1[] a)`

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

      `equals, hashCode, spliterator`

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

      `parallelStream, removeIf, stream`

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

      `forEach`

- - ### Method Detail

    - #### add

          boolean add(T t)
               throws IgniteException

      Specified by:
        `add` in interface `Collection<T>`
      Specified by:
        `add` in interface `Set<T>`
      Throws:
        `IgniteException`

    - #### addAll

          boolean addAll(Collection<? extends T> c)
                  throws IgniteException

      Specified by:
        `addAll` in interface `Collection<T>`
      Specified by:
        `addAll` in interface `Set<T>`
      Throws:
        `IgniteException`

    - #### clear

          void clear()
              throws IgniteException

      Specified by:
        `clear` in interface `Collection<T>`
      Specified by:
        `clear` in interface `Set<T>`
      Throws:
        `IgniteException`

    - #### contains

          boolean contains(Object o)
                    throws IgniteException

      Specified by:
        `contains` in interface `Collection<T>`
      Specified by:
        `contains` in interface `Set<T>`
      Throws:
        `IgniteException`

    - #### containsAll

          boolean containsAll(Collection<?> c)
                       throws IgniteException

      Specified by:
        `containsAll` in interface `Collection<T>`
      Specified by:
        `containsAll` in interface `Set<T>`
      Throws:
        `IgniteException`

    - #### isEmpty

          boolean isEmpty()
                   throws IgniteException

      Specified by:
        `isEmpty` in interface `Collection<T>`
      Specified by:
        `isEmpty` in interface `Set<T>`
      Throws:
        `IgniteException`

    - #### iterator

          Iterator<T> iterator()
                        throws IgniteException

      Specified by:
        `iterator` in interface `Collection<T>`
      Specified by:
        `iterator` in interface `Iterable<T>`
      Specified by:
        `iterator` in interface `Set<T>`
      Throws:
        `IgniteException`

    - #### remove

          boolean remove(Object o)
                  throws IgniteException

      Specified by:
        `remove` in interface `Collection<T>`
      Specified by:
        `remove` in interface `Set<T>`
      Throws:
        `IgniteException`

    - #### removeAll

          boolean removeAll(Collection<?> c)
                     throws IgniteException

      Specified by:
        `removeAll` in interface `Collection<T>`
      Specified by:
        `removeAll` in interface `Set<T>`
      Throws:
        `IgniteException`

    - #### retainAll

          boolean retainAll(Collection<?> c)
                     throws IgniteException

      Specified by:
        `retainAll` in interface `Collection<T>`
      Specified by:
        `retainAll` in interface `Set<T>`
      Throws:
        `IgniteException`

    - #### size

          int size()
            throws IgniteException

      Specified by:
        `size` in interface `Collection<T>`
      Specified by:
        `size` in interface `Set<T>`
      Throws:
        `IgniteException`

    - #### toArray

          Object[] toArray()
                    throws IgniteException

      Specified by:
        `toArray` in interface `Collection<T>`
      Specified by:
        `toArray` in interface `Set<T>`
      Throws:
        `IgniteException`

    - #### toArray

          <T1> T1[] toArray(T1[] a)
                     throws IgniteException

      Specified by:
        `toArray` in interface `Collection<T>`
      Specified by:
        `toArray` in interface `Set<T>`
      Throws:
        `IgniteException`

    - #### close

          void close()
              throws IgniteException

      Removes this set. In order to check the state it is possible to use `removed()`.
      Specified by:
        `close` in interface `AutoCloseable`
      Specified by:
        `close` in interface `Closeable`
      Throws:
        `IgniteException` - If operation failed.

    - #### name

          String name()

      Gets set name.
      Returns:
        Set name.

    - #### collocated

          boolean collocated()

      Returns `true` if this set can be kept on the one node only. Returns `false` if this set can be kept on the many nodes.
      Returns:
        `True` if this set is in `collocated` mode `false` otherwise.

    - #### removed

          boolean removed()

      Gets status of set. In order to change the status it is possible to use `close()` method.
      Returns:
        `True` if set was removed from cache `false` otherwise.

    - #### affinityRun

          void affinityRun(IgniteRunnable job)
                    throws IgniteException

      Executes given job on collocated set on the node where the set is located (a.k.a. affinity co-location).

      This is not supported for non-collocated sets.

      Parameters:
        `job` - Job which will be co-located with the set.
      Throws:
        `IgniteException` - If job failed.

    - #### affinityCall

          <R> R affinityCall(IgniteCallable<R> job)
                      throws IgniteException

      Executes given job on collocated set on the node where the set is located (a.k.a. affinity co-location).

      This is not supported for non-collocated sets.

      Parameters:
        `job` - Job which will be co-located with the set.
      Throws:
        `IgniteException` - If job failed.

2021 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.11.0
Release Date | : September 11 2021