org.apache.ignite.client

## Interface ClientIgniteSet<T>

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

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

  Distributed Set.

  # Overview

  Cache set implements `Set` interface and provides all methods from collections.

  # Colocated vs Non-colocated

  Set items can be placed on one node or distributed across grid nodes (governed by `ClientCollectionConfiguration.setColocated(boolean)` parameter). `Non-colocated` mode is provided only for partitioned caches. If `colocated` parameter is `true`, then all set items will be colocated on one node, otherwise items will be distributed across all grid nodes.
  See Also:
    `IgniteClient.set(String, org.apache.ignite.client.ClientCollectionConfiguration)`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `add(T o)`
    `boolean` | `addAll(Collection<? extends T> c)`
    `void` | `clear()`
    `void` | `close()` Removes this set.
    `boolean` | `colocated()` Gets a value indicating whether all items of this set are stored on a single node.
    `boolean` | `contains(Object o)`
    `boolean` | `containsAll(Collection<?> c)`
    `boolean` | `isEmpty()`
    `ClientAutoCloseableIterator<T>` | `iterator()` Returns an iterator over the elements in this collection.
    `String` | `name()` Gets set name.
    `int` | `pageSize()` Gets the page size to be used for batched network data retrieval in `iterator()` and `toArray()`.
    `ClientIgniteSet<T>` | `pageSize(int pageSize)` Sets the page size to be used for batched network data retrieval in `iterator()` and `toArray()`.
    `boolean` | `remove(Object o)`
    `boolean` | `removeAll(Collection<?> c)`
    `boolean` | `removed()` Gets a value indicating whether this set has been removed (`close()` was called).
    `boolean` | `retainAll(Collection<?> c)`
    `boolean` | `serverKeepBinary()` Gets a value indicating whether user objects should be kept in binary form on the server, or deserialized.
    `ClientIgniteSet<T>` | `serverKeepBinary(boolean keepBinary)` Sets a value indicating whether user objects should be kept in binary form on the server, or deserialized.
    `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 o)

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

    - #### addAll

          boolean addAll(Collection<? extends T> c)

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

    - #### clear

          void clear()

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

    - #### contains

          boolean contains(Object o)

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

    - #### containsAll

          boolean containsAll(Collection<?> c)

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

    - #### isEmpty

          boolean isEmpty()

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

    - #### iterator

          ClientAutoCloseableIterator<T> iterator()

      Returns an iterator over the elements in this collection.

      There are no guarantees concerning the order in which the elements are returned.

      Returned iterator is `AutoCloseable`: it may hold server-side resources and must be closed. It will close itself when the last page of data (see `pageSize()`) is fetched from the server. When `Iterator.hasNext()` returns `false`, it is guaranteed that the iterator is closed. In other cases (incomplete iteration) the user must close the iterator.

      Specified by:
        `iterator` in interface `Collection<T>`
      Specified by:
        `iterator` in interface `Iterable<T>`
      Specified by:
        `iterator` in interface `Set<T>`
      Returns:
        an Iterator over the elements in this collection.

    - #### remove

          boolean remove(Object o)

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

    - #### removeAll

          boolean removeAll(Collection<?> c)

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

    - #### retainAll

          boolean retainAll(Collection<?> c)

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

    - #### size

          int size()

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

    - #### toArray

          Object[] toArray()

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

    - #### toArray

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

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

    - #### close

          void close()

      Removes this set.
      Specified by:
        `close` in interface `AutoCloseable`
      Specified by:
        `close` in interface `Closeable`

    - #### name

          String name()

      Gets set name.
      Returns:
        Set name.

    - #### colocated

          boolean colocated()

      Gets a value indicating whether all items of this set are stored on a single node.
      Returns:
        `True` if all items of this set are stored on a single node, `false` otherwise.

    - #### removed

          boolean removed()

      Gets a value indicating whether this set has been removed (`close()` was called).
      Returns:
        `True` if set was removed from cache, `false` otherwise.

    - #### serverKeepBinary

          ClientIgniteSet<T> serverKeepBinary(boolean keepBinary)

      Sets a value indicating whether user objects should be kept in binary form on the server, or deserialized.

      Default is `true`: does not require classes on server, interoperable with other thin clients, performs better. Suitable for most use cases.

      Set to `false` if there is a requirement to use deserialized objects in "thick" API (`IgniteSet`) together with thin client API, like in this scenario:

            ClientIgniteSet<UserObj> clientSet = client.set("my-set", new ClientCollectionConfiguration());
            clientSet.serverKeepBinary(false);

            IgniteSet<UserObj> serverSet = server.set(clientSet.name(), null);

            clientSet.add(new UserObj(1, "client"));
            assert serverSet.contains(new UserObj(1, "client"));

      Parameters:
        `keepBinary` - Whether to keep objects in binary form on the server.
      Returns:
        This set instance (for chaining).

    - #### serverKeepBinary

          boolean serverKeepBinary()

      Gets a value indicating whether user objects should be kept in binary form on the server, or deserialized.

      Default is `true`: does not require classes on server, interoperable with other thin clients, performs better. Suitable for most use cases.

      Set to `false` if there is a requirement to use deserialized objects in "thick" API (`IgniteSet`) together with thin client API, like in this scenario:

            ClientIgniteSet<UserObj> clientSet = client.set("my-set", new ClientCollectionConfiguration());
            clientSet.serverKeepBinary(false);

            IgniteSet<UserObj> serverSet = server.set(clientSet.name(), null);

            clientSet.add(new UserObj(1, "client"));
            assert serverSet.contains(new UserObj(1, "client"));

      Returns:
        `true` when user objects will be kept in binary form on the server, `false` otherwise.

    - #### pageSize

          ClientIgniteSet<T> pageSize(int pageSize)

      Sets the page size to be used for batched network data retrieval in `iterator()` and `toArray()`.
      Parameters:
        `pageSize` - Page size.
      Returns:
        This set instance (for chaining).

    - #### pageSize

          int pageSize()

      Gets the page size to be used for batched network data retrieval in `iterator()` and `toArray()`.
      Returns:
        Page size.

${current.year} Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.16.0
Release Date | : December 15 2023