class Vertx::SharedData::SharedSet
@private
Public Class Methods
@private
# File lib/vertx/shared_data.rb, line 121 def initialize(j_set) @j_set = j_set end
Public Instance Methods
# File lib/vertx/shared_data.rb, line 125 def ==(other) if other.is_a?(SharedSet) @j_set.equal?(other._to_java_set) else false end end
@private
# File lib/vertx/shared_data.rb, line 208 def _to_java_set @j_set end
Add an object to the set @param [Object] obj. The object to add @return [SharedSet} self
# File lib/vertx/shared_data.rb, line 136 def add(obj) obj = SharedData.check_obj(obj) @j_set.add(obj) self end
Add an object to the set @param [Object] obj. The object to add @return [SharedSet] self if the object is not already in the set, otherwise nil
# File lib/vertx/shared_data.rb, line 145 def add?(obj) obj = SharedData.check_obj(obj) if !@j_set.contains(obj) @j_set.add(obj) self else nil end end
Clear the set
# File lib/vertx/shared_data.rb, line 156 def clear @j_set.clear end
Delete an object from the set @param [Object] obj. The object to delete
# File lib/vertx/shared_data.rb, line 162 def delete(obj) @j_set.remove(obj) end
Delete an object from the set @param [Object] obj. The object to delete @return [SharedSet] self if the object was in the set before the remove, nil otherwise.
# File lib/vertx/shared_data.rb, line 169 def delete?(obj) if @j_set.contains(obj) @j_set.remove(obj) self else nil end end
Call the block for every element of the set @param [Blovk] block. The block to call.
# File lib/vertx/shared_data.rb, line 180 def each(&block) iter = @j_set.iterator while iter.hasNext do obj = iter.next obj = Buffer.new(obj) if obj.is_a? org.vertx.java.core.buffer.Buffer block.call(obj) end end
@return [Boolean] true if the set is empty
# File lib/vertx/shared_data.rb, line 190 def empty? @j_set.isEmpty end
Does the set contain an element? @param [Object] obj, the object to check if the set contains @return [Boolean] true if the object is contained in the set
# File lib/vertx/shared_data.rb, line 197 def include?(obj) obj = obj._to_java_buffer if obj.is_a? Buffer @j_set.contains(obj) end
@return [FixNum] The number of elements in the set
# File lib/vertx/shared_data.rb, line 203 def size @j_set.size end