Set

class Set(client, service_name, name)

Bases: hazelcast.proxy.base.PartitionSpecificProxy

Concurrent, distributed implementation of Set.

add(item)

Adds the specified item if it is not exists in this set.

Parameters:item – (object), the specified item to be added.
Returns:(bool), true if this set is changed after call, false otherwise.
add_all(items)

Adds the elements in the specified collection if they’re not exist in this set.

Parameters:items – (Collection), collection which includes the items to be added.
Returns:(bool), true if this set is changed after call, false otherwise.
add_listener(include_value=False, item_added_func=None, item_removed_func=None)

Adds an item listener for this container. Listener will be notified for all container add/remove events.

Parameters:
  • include_value – (bool), whether received events include the updated item or not (optional).
  • item_added_func – Function to be called when an item is added to this set (optional).
  • item_removed_func – Function to be called when an item is deleted from this set (optional).
Returns:

(str), a registration id which is used as a key to remove the listener.

clear()

Clears the set. Set will be empty with this call.

contains(item)

Determines whether this set contains the specified item or not.

Parameters:item – (object), the specified item to be searched.
Returns:(bool), true if the specified item exists in this set, false otherwise.
contains_all(items)

Determines whether this set contains all of the items in the specified collection or not.

Parameters:items – (Collection), the specified collection which includes the items to be searched.
Returns:(bool), true if all of the items in the specified collection exist in this set, false otherwise.
get_all()

Returns all of the items in the set.

Returns:(Sequence), list of the items in this set.
is_empty()

Determines whether this set is empty or not.

Returns:(bool), true if this set is empty, false otherwise.
remove(item)

Removes the specified element from the set if it exists.

Parameters:item – (object), the specified element to be removed.
Returns:(bool), true if the specified element exists in this set.
remove_all(items)

Removes all of the elements of the specified collection from this set.

Parameters:items – (Collection), the specified collection.
Returns:(bool), true if the call changed this set, false otherwise.
remove_listener(registration_id)

Removes the specified item listener. Returns silently if the specified listener was not added before.

Parameters:registration_id – (str), id of the listener to be deleted.
Returns:(bool), true if the item listener is removed, false otherwise.
retain_all(items)

Removes the items which are not contained in the specified collection. In other words, only the items that are contained in the specified collection will be retained.

Parameters:items – (Collection), collection which includes the elements to be retained in this set.
Returns:(bool), true if this set changed as a result of the call.
size()

Returns the number of items in this set.

Returns:(int), number of items in this set.