Package org.jruby
Class RubyHash
java.lang.Object
org.jruby.RubyBasicObject
org.jruby.RubyObject
org.jruby.RubyHash
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<IRubyObject>
,Map
,InstanceVariables
,InternalVariables
,IRubyObject
,CoreObjectType
- Direct Known Subclasses:
RubyGlobal.StringOnlyRubyHash
,RubySet.DivideTSortHash
Implementation of the Hash class.
Concurrency: no synchronization is required among readers, but
all users must synchronize externally with writers.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
static class
static class
static interface
Nested classes/interfaces inherited from class org.jruby.RubyObject
RubyObject.Data
Nested classes/interfaces inherited from class org.jruby.RubyBasicObject
RubyBasicObject.Finalizer
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int[]
static final RubyHash.RubyHashEntry
static final int
protected int
static final RubyHash.VisitorWithState
<RubyArray> Fields inherited from class org.jruby.RubyObject
IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATOR
Fields inherited from class org.jruby.RubyBasicObject
ALL_F, BASICOBJECT_ALLOCATOR, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, IS_OVERLAID_F, metaClass, NEVER, NIL_F, REFINED_MODULE_F, STAMP_OFFSET, TAINTED_F, UNDEF, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_F, USER9_F, USERA_F, VAR_TABLE_OFFSET, varTable, varTableStamp
Fields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY
-
Constructor Summary
ConstructorsModifierConstructorDescriptionRubyHash
(Ruby runtime, Map valueMap, IRubyObject defaultValue) protected
RubyHash
(Ruby runtime, RubyClass metaClass, IRubyObject defaultValue, RubyHash.RubyHashEntry[] initialTable, int threshold) RubyHash
(Ruby runtime, IRubyObject defaultValue) RubyHash
(Ruby runtime, IRubyObject defaultValue, int buckets) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAll
(ThreadContext context, RubyHash otherHash) <T> boolean
any_p
(ThreadContext context, Block block) any_p
(ThreadContext context, IRubyObject[] args, Block block) Deprecated.any_p
(ThreadContext context, IRubyObject pattern, Block block) protected IRubyObject
any_p_i
(ThreadContext context, Block block) protected IRubyObject
any_p_i_fast
(ThreadContext context, Block block) protected IRubyObject
any_p_p
(ThreadContext context, IRubyObject pattern) protected void
appendAssociation
(boolean keyIsSymbol, ByteList bytes) Append appropriate characters to indicate association (": " vs " => ").aref
(IRubyObject key) Deprecated, for removal: This API element is subject to removal in a future version.use RubyHash.op_aref insteadaset
(IRubyObject key, IRubyObject value) Deprecated, for removal: This API element is subject to removal in a future version.use RubyHash.op_aset insteadassoc
(ThreadContext context, IRubyObject obj) protected final void
void
clear()
compact
(ThreadContext context) compact_bang
(ThreadContext context) compare
(ThreadContext context, RubyHash.VisitorWithState<RubyHash> visitor, IRubyObject other, boolean eql) compare_by_identity
(ThreadContext context) compare_by_identity_p
(ThreadContext context) boolean
containsKey
(Object key) boolean
containsValue
(Object value) Tries to convert this object to a Ruby Hash using the "to_hash" method.static IRubyObject
create
(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) rb_hash_s_createstatic RubyClass
createHashClass
(ThreadContext context, RubyClass Object, RubyModule Enumerable) deconstruct_keys
(ThreadContext context, IRubyObject _arg1) Deprecated.default_proc
(ThreadContext context) rb_hash_default_procdefault_value_get
(ThreadContext context) default_value_get
(ThreadContext context, IRubyObject arg) default_value_get
(ThreadContext context, IRubyObject[] args) Deprecated.default_value_set
(IRubyObject defaultValue) Deprecated.default_value_set
(ThreadContext context, IRubyObject defaultValue) rb_hash_set_defaultdelete
(IRubyObject key) Delete entry or null.delete
(ThreadContext context, IRubyObject key) delete
(ThreadContext context, IRubyObject key, Block block) rb_hash_deletedelete_if
(ThreadContext context, Block block) delete_ifInternal
(ThreadContext context, Block block) rb_hash_delete_ifdig
(ThreadContext context, IRubyObject arg0) dig
(ThreadContext context, IRubyObject[] args) dig
(ThreadContext context, IRubyObject arg0, IRubyObject arg1) dig
(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) dup
(ThreadContext context) RubyMethod dup.dupFast
(ThreadContext context) A lightweight dup for internal use that does not dispatch to initialize_copy nor rehash the keys.each
(ThreadContext context, Block block) each_key
(ThreadContext context, Block block) each_keyCommon
(ThreadContext context, Block block) rb_hash_each_keyeach_pair
(ThreadContext context, Block block) Deprecated.each_pairCommon
(ThreadContext context, Block block) rb_hash_each_paireach_pairCommon
(ThreadContext context, Block block, boolean oneNine) Deprecated.each_value
(ThreadContext context, Block block) each_valueCommon
(ThreadContext context, Block block) rb_hash_each_valueeachCommon
(ThreadContext context, Block block) rb_hash_eachempty_p()
Deprecated.empty_p
(ThreadContext context) rb_hash_empty_pentrySet()
boolean
This override does not do a "checked" dispatch.except
(ThreadContext context, IRubyObject[] keys) final IRubyObject
fastARef
(IRubyObject key) final void
fastASet
(Ruby runtime, IRubyObject key, IRubyObject value, boolean prepareString) final void
fastASet
(IRubyObject key, IRubyObject value) final void
fastASetCheckString
(Ruby runtime, IRubyObject key, IRubyObject value) final void
fastASetSmall
(Ruby runtime, IRubyObject key, IRubyObject value, boolean prepareString) final void
fastASetSmall
(IRubyObject key, IRubyObject value) final void
fastASetSmallCheckString
(Ruby runtime, IRubyObject key, IRubyObject value) final void
fastASetSmallPair
(ThreadContext context, IRubyObject _pair) final boolean
fastDelete
(IRubyObject key) fetch
(ThreadContext context, IRubyObject[] args, Block block) rb_hash_fetchfetch
(ThreadContext context, IRubyObject key, Block block) fetch
(ThreadContext context, IRubyObject key, IRubyObject _default, Block block) fetch_values
(ThreadContext context, IRubyObject[] args, Block block) flatten
(ThreadContext context) flatten
(ThreadContext context, IRubyObject level) Will return the Java interface that most closely can represent this object, when working through Java integration translations.This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are.has_key_p
(IRubyObject key) Deprecated.has_key_p
(ThreadContext context, IRubyObject key) rb_hash_has_keyhas_value_p
(ThreadContext context, IRubyObject expected) rb_hash_has_valueboolean
hash
(ThreadContext context) Will return the hash code of this object.protected final int
hashValue
(IRubyObject key) boolean
hasKey
(IRubyObject key) A Java API to test the presence of a (Ruby) key in the Hashinitialize
(IRubyObject[] args, Block block) Deprecated.initialize
(ThreadContext context, Block block) rb_hash_initializeinitialize
(ThreadContext context, IRubyObject _default, Block block) initialize
(ThreadContext context, IRubyObject _default, IRubyObject hash, Block block) initialize_copy
(ThreadContext context, IRubyObject other) Initializes this object as a copy of the original, that is the parameter to this object.inspect
(ThreadContext context) rb_hash_inspectprotected RubyString
inspectHash
(ThreadContext context) inspect_hashprotected RubyHash.RubyHashEntry
protected RubyHash.RubyHashEntry
protected IRubyObject
internalGet
(IRubyObject key) protected RubyHash.RubyHashEntry
protected final IRubyObject
internalJavaPut
(IRubyObject key, IRubyObject value) Deprecated.internalPut
(IRubyObject key, IRubyObject value) protected IRubyObject
internalPutNoResize
(IRubyObject key, IRubyObject value, boolean checkForExisting) protected void
internalPutSmall
(IRubyObject key, IRubyObject value, boolean checkForExisting) Deprecated.invert
(ThreadContext context) rb_hash_invertboolean
Is this object compared by identity or not? Shortcut for doing getFlag(COMPARE_BY_IDENTITY_F).boolean
isEmpty()
boolean
keep_if
(ThreadContext context, Block block) boolean
keep_ifCommon
(ThreadContext context, Block block) key
(ThreadContext context, IRubyObject expected) final RubyArray
keys()
keys
(ThreadContext context) rb_hash_keyskeySet()
static void
marshalTo
(RubyHash hash, MarshalStream output) Deprecated, for removal: This API element is subject to removal in a future version.static void
marshalTo
(ThreadContext context, RubyOutputStream out, RubyHash hash, MarshalDumper output) merge
(ThreadContext context, IRubyObject[] others, Block block) rb_hash_mergemerge
(ThreadContext context, IRubyObject other, Block block) Deprecated.merge_bang
(ThreadContext context, IRubyObject[] others, Block block) rb_hash_updatemerge_bang
(ThreadContext context, IRubyObject other, Block block) Deprecated.void
modify()
rb_hash_modifystatic final RubyHash
rb_hash_newstatic final RubyHash
newHash
(Ruby runtime, Map valueMap, IRubyObject defaultValue) rb_hash_newstatic RubyHash
newHash
(Ruby runtime, IRubyObject key, IRubyObject value) static RubyHash
newKwargs
(Ruby runtime, String key, IRubyObject value) static final RubyHash
newSmallHash
(Ruby runtime) rb_hash_newop_aref
(ThreadContext context, IRubyObject key) rb_hash_arefop_aset
(IRubyObject key, IRubyObject value) Deprecated.op_aset
(ThreadContext context, IRubyObject key, IRubyObject value) Set a key/value pair into this hash.protected void
op_asetForString
(Ruby runtime, RubyString key, IRubyObject value) protected void
op_asetSmallForString
(Ruby runtime, RubyString key, IRubyObject value) op_eql
(ThreadContext context, IRubyObject other) rb_hash_eqlop_equal
(ThreadContext context, IRubyObject other) rb_hash_equalop_ge
(ThreadContext context, IRubyObject other) op_gt
(ThreadContext context, IRubyObject other) op_le
(ThreadContext context, IRubyObject other) op_lt
(ThreadContext context, IRubyObject other) void
rassoc
(ThreadContext context, IRubyObject obj) rb_clear()
Deprecated.rb_clear
(ThreadContext context) rb_hash_clearrb_size()
Deprecated.rb_size
(ThreadContext context) rb_hash_sizefinal RubyArray
Deprecated.final RubyArray
rb_values
(ThreadContext context) rbClone
(ThreadContext context) rbClone
(ThreadContext context, IRubyObject opts) rehash()
Deprecated.rehash
(ThreadContext context) rb_hash_rehashreject
(ThreadContext context, Block block) reject_bang
(ThreadContext context, Block block) reject_bangInternal
(ThreadContext context, Block block) rb_hash_reject_bangrejectInternal
(ThreadContext context, Block block) rb_hash_rejectreplace
(ThreadContext context, IRubyObject other) rb_hash_replaceprotected void
replaceExternally
(ThreadContext context, RubyHash otherHash) protected void
replaceWith
(ThreadContext context, RubyHash otherHash) static IRubyObject
ruby2_keywords_hash
(ThreadContext context, IRubyObject _self, IRubyObject arg) static IRubyObject
ruby2_keywords_hash_p
(ThreadContext context, IRubyObject _self, IRubyObject arg) select
(ThreadContext context, Block block) rb_hash_selectselect_bang
(ThreadContext context, Block block) set_default_proc
(IRubyObject proc) Deprecated.set_default_proc
(ThreadContext context, IRubyObject proc) rb_hash_set_default_procvoid
setComparedByIdentity
(boolean comparedByIdentity) Sets whether this object is compared by identity or not.void
setRuby2KeywordHash
(boolean value) shift
(ThreadContext context) rb_hash_shiftint
size()
slice
(ThreadContext context, IRubyObject[] args) rb_hash_slicesort
(ThreadContext context, Block block) Deprecated.to_a()
Deprecated.to_a
(ThreadContext context) rb_hash_to_ato_h
(ThreadContext context) Deprecated.to_h
(ThreadContext context, Block block) protected RubyHash
to_h_block
(ThreadContext context, Block block) to_hash()
Deprecated.to_hash
(ThreadContext context) rb_hash_to_hashto_proc
(ThreadContext context) to_s
(ThreadContext context) rb_hash_to_s & to_s_hashtransform_keys
(ThreadContext context, IRubyObject[] args, Block block) transform_keys_bang
(ThreadContext context, IRubyObject[] args, Block block) transform_values
(ThreadContext context, Block block) transform_values_bang
(ThreadContext context, Block block) static IRubyObject
try_convert
(ThreadContext context, IRubyObject recv, IRubyObject args) static RubyHash
unmarshalFrom
(UnmarshalStream input, boolean defaultValue) Deprecated, for removal: This API element is subject to removal in a future version.static RubyHash
unmarshalFrom
(ThreadContext context, RubyInputStream in, MarshalLoader input, boolean defaultValue) values()
values
(ThreadContext context) rb_hash_valuesvalues_at
(ThreadContext context, IRubyObject[] args) rb_hash_values_atfinal void
visitAll
(RubyHash.Visitor visitor) Deprecated.<T> void
visitAll
(ThreadContext context, RubyHash.VisitorWithStateI visitor) <T> void
visitAll
(ThreadContext context, RubyHash.VisitorWithState visitor, T state) Methods inherited from class org.jruby.RubyObject
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, dig, dig1, dig2, eqlInternal, equalInternal, finishObjectClass, hashCode, inspect, op_eqq, puts, specificEval, toRubyString, toString
Methods inherited from class org.jruby.RubyBasicObject
addFinalizer, addFinalizer, anyToString, asJavaString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkCallMethod, checkFrozen, checkStringType, cloneSetup, compareTo, convertToArray, convertToFloat, convertToInteger, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, copySpecialInstanceVariables, dataGetStruct, dataGetStructChecked, dataWrapStruct, decode, display, dup, dupFinalizer, dupSetup, ensureInstanceVariablesSettable, eql, eql_p, eql_p, equal_p, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, finishBasicObjectClass, forEachInstanceVariable, forEachInstanceVariableName, freeze, frozen_p, getCurrentContext, getFFIHandle, getFlag, getInstanceEvalClass, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getMarshalVariableList, getMetaClass, getMetaClass, getNativeHandle, getNativeTypeIndex, getObjectId, getRuntime, getSingletonClass, getSingletonClassClone, getSingletonClassCloneAndAttach, getSingletonClassCloneAndAttach, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hash, hashyInspect, hasInstanceVariable, hasInstanceVariables, hasInternalVariable, hasVariables, id, infectBy, initialize, initialize_copy, inspect, inspectHashCode, instance_eval, instance_eval, instance_eval, instance_eval, instance_eval, instance_exec, instance_of_p, instance_variable_defined_p, instance_variable_get, instance_variable_set, instance_variables, isBuiltin, isClass, isFalse, isFrozen, isImmediate, isModule, isNil, isSpecialConst, isSpecialObject, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, makeMetaClass, makeMetaClassBootstrap, method, method, method, method_missing, methods, methods, nil_p, nonFixnumHashCode, nonFixnumHashCode, OBJ_INIT_COPY, objInitCopy, op_cmp, op_match, op_not, op_not_equal, op_not_match, private_methods, protected_methods, public_methods, rbClone, rbInspect, remove_instance_variable, removeFinalizers, removeInstanceVariable, removeInternalVariable, respond_to_p, respond_to_p, respondsTo, respondsToMissing, respondsToMissing, send, send, send, send, send, setFFIHandle, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setNativeHandle, setTaint, setUntrusted, setVariable, singleton_method, singleton_method, singleton_method_added, singleton_method_removed, singleton_method_undefined, singleton_methods, singletonClass, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, taint, tainted_p, testFrozen, testFrozen, to_s, toJava, trust, type, untaint, untrust, untrusted_p, validateInstanceVariable, validateInstanceVariable, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnder
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jruby.runtime.builtin.IRubyObject
checkStringType19, marshalLiveVariables
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
DEFAULT_INSPECT_STR_SIZE
public static final int DEFAULT_INSPECT_STR_SIZE- See Also:
-
COMPARE_BY_IDENTITY_F
public static final int COMPARE_BY_IDENTITY_F -
RUBY2_KEYWORD_F
public static final int RUBY2_KEYWORD_F -
size
protected int size -
MRI_PRIMES
public static final int[] MRI_PRIMES -
NO_ENTRY
-
StoreValueVisitor
-
-
Constructor Details
-
RubyHash
-
RubyHash
-
RubyHash
-
RubyHash
-
RubyHash
-
RubyHash
protected RubyHash(Ruby runtime, RubyClass metaClass, IRubyObject defaultValue, RubyHash.RubyHashEntry[] initialTable, int threshold) -
RubyHash
-
-
Method Details
-
createHashClass
public static RubyClass createHashClass(ThreadContext context, RubyClass Object, RubyModule Enumerable) -
getNativeClassIndex
Description copied from class:RubyObject
This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are. Will generally return a value from org.jruby.runtime.ClassIndex- Specified by:
getNativeClassIndex
in interfaceCoreObjectType
- Overrides:
getNativeClassIndex
in classRubyObject
- Returns:
- the ClassIndex of the native type this object was constructed from
- See Also:
-
create
public static IRubyObject create(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) rb_hash_s_create -
try_convert
-
newHash
rb_hash_new -
newSmallHash
rb_hash_new -
newKwargs
-
newHash
-
newHash
rb_hash_new -
hashValue
-
checkIterating
protected final void checkIterating() -
internalPut
-
internalJavaPut
Deprecated. -
internalPutNoResize
protected IRubyObject internalPutNoResize(IRubyObject key, IRubyObject value, boolean checkForExisting) -
internalGet
-
internalGetEntry
-
internalDelete
-
internalDeleteEntry
-
visitAll
-
visitAll
-
allSymbols
public <T> boolean allSymbols() -
initialize
rb_hash_initialize -
initialize
-
initialize
public IRubyObject initialize(ThreadContext context, IRubyObject _default, IRubyObject hash, Block block) -
default_value_get
-
default_value_get
-
default_value_set
rb_hash_set_default -
default_proc
rb_hash_default_proc -
set_default_proc
rb_hash_set_default_proc -
modify
public void modify()rb_hash_modify -
inspectHash
inspect_hash -
appendAssociation
Append appropriate characters to indicate association (": " vs " => ").- Parameters:
keyIsSymbol
- is the key a symbolbytes
- buffer to which to append
-
inspect
rb_hash_inspect- Specified by:
inspect
in interfaceIRubyObject
- Overrides:
inspect
in classRubyBasicObject
-
rb_size
rb_hash_size -
empty_p
rb_hash_empty_p -
to_a
rb_hash_to_a- Overrides:
to_a
in classRubyBasicObject
-
to_s
rb_hash_to_s & to_s_hash- Overrides:
to_s
in classRubyBasicObject
-
rehash
rb_hash_rehash -
to_hash
rb_hash_to_hash -
to_h
Deprecated. -
to_h
-
to_h_block
-
convertToHash
Description copied from class:RubyBasicObject
Tries to convert this object to a Ruby Hash using the "to_hash" method.- Specified by:
convertToHash
in interfaceIRubyObject
- Overrides:
convertToHash
in classRubyBasicObject
- Returns:
- hash representation of this
-
fastASet
-
fastASetSmall
-
fastASetSmallPair
-
fastASetCheckString
-
fastASetSmallCheckString
-
fastASet
-
fastASetSmall
public final void fastASetSmall(Ruby runtime, IRubyObject key, IRubyObject value, boolean prepareString) -
op_aset
Set a key/value pair into this hash.- Parameters:
context
- the current thread contextkey
- the keyvalue
- the value- Returns:
- the value set
-
op_asetForString
-
op_asetSmallForString
-
fastARef
-
compare
public RubyBoolean compare(ThreadContext context, RubyHash.VisitorWithState<RubyHash> visitor, IRubyObject other, boolean eql) -
op_equal
rb_hash_equal- Specified by:
op_equal
in interfaceIRubyObject
- Overrides:
op_equal
in classRubyBasicObject
-
op_eql
rb_hash_eql -
op_aref
rb_hash_aref -
op_lt
-
op_le
-
op_gt
-
op_ge
-
hash
Description copied from class:RubyBasicObject
Will return the hash code of this object. In comparison to MRI, this method will use the Java identity hash code instead of using rb_obj_id, since the usage of id in JRuby will incur the cost of some. ObjectSpace maintenance.- Overrides:
hash
in classRubyBasicObject
- Parameters:
context
- the current thread context- Returns:
- the hash value
-
fetch
rb_hash_fetch -
except
-
fetch
-
fetch
-
has_key_p
rb_hash_has_key -
has_key_p
Deprecated. -
hasKey
A Java API to test the presence of a (Ruby) key in the Hash- Parameters:
key
- the native (Ruby) key- Returns:
- true if the hash contains the provided key
-
has_value_p
rb_hash_has_value -
eachCommon
rb_hash_each -
each
-
each_pairCommon
rb_hash_each_pair -
each_valueCommon
rb_hash_each_value -
each_value
-
each_keyCommon
rb_hash_each_key -
each_key
-
transform_keys
-
transform_values
-
transform_keys_bang
-
transform_values_bang
-
select_bang
-
keep_if
-
keep_ifCommon
-
sort
Deprecated. -
key
-
keys
rb_hash_keys -
keys
-
values
rb_hash_values -
rb_values
-
shift
rb_hash_shift -
fastDelete
-
delete
rb_hash_delete -
delete
Delete entry or null. -
delete
-
select
rb_hash_select -
slice
rb_hash_slice -
delete_ifInternal
rb_hash_delete_if -
delete_if
-
rejectInternal
rb_hash_reject -
reject
-
reject_bangInternal
rb_hash_reject_bang -
reject_bang
-
rb_clear
rb_hash_clear -
invert
rb_hash_invert -
merge_bang
Deprecated. -
merge_bang
rb_hash_update -
addAll
-
merge
Deprecated. -
merge
rb_hash_merge -
initialize_copy
Description copied from class:RubyBasicObject
Initializes this object as a copy of the original, that is the parameter to this object. Will make sure that the argument actually has the same real class as this object. It shouldn't be possible to initialize an object with something totally different.- Overrides:
initialize_copy
in classRubyBasicObject
- Parameters:
context
- the thread contextother
- the original- Returns:
- a copy unless the same thing
-
replace
rb_hash_replace -
replaceWith
-
replaceExternally
-
values_at
rb_hash_values_at -
fetch_values
-
assoc
-
rassoc
-
flatten
-
flatten
-
compact
-
compact_bang
-
compare_by_identity
-
compare_by_identity_p
-
dup
Description copied from interface:IRubyObject
RubyMethod dup.- Specified by:
dup
in interfaceIRubyObject
- Parameters:
context
- the thread context- Returns:
- a dup-ed object
-
rbClone
- Overrides:
rbClone
in classRubyBasicObject
-
rbClone
-
any_p
-
any_p
-
any_p_i
-
any_p_i_fast
-
any_p_p
-
dupFast
A lightweight dup for internal use that does not dispatch to initialize_copy nor rehash the keys. Intended for use in dup'ing keyword args for processing.- Parameters:
context
-- Returns:
-
hasDefaultProc
public boolean hasDefaultProc() -
getIfNone
-
deconstruct_keys
-
dig
-
dig
-
dig
-
dig
-
to_proc
-
ruby2_keywords_hash
public static IRubyObject ruby2_keywords_hash(ThreadContext context, IRubyObject _self, IRubyObject arg) -
ruby2_keywords_hash_p
public static IRubyObject ruby2_keywords_hash_p(ThreadContext context, IRubyObject _self, IRubyObject arg) -
marshalTo
@Deprecated(since="10.0", forRemoval=true) public static void marshalTo(RubyHash hash, MarshalStream output) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.- Throws:
IOException
-
marshalTo
public static void marshalTo(ThreadContext context, RubyOutputStream out, RubyHash hash, MarshalDumper output) -
unmarshalFrom
@Deprecated(since="10.0", forRemoval=true) public static RubyHash unmarshalFrom(UnmarshalStream input, boolean defaultValue) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.- Throws:
IOException
-
unmarshalFrom
public static RubyHash unmarshalFrom(ThreadContext context, RubyInputStream in, MarshalLoader input, boolean defaultValue) -
getJavaClass
Description copied from class:RubyBasicObject
Will return the Java interface that most closely can represent this object, when working through Java integration translations.- Specified by:
getJavaClass
in interfaceIRubyObject
- Overrides:
getJavaClass
in classRubyBasicObject
- Returns:
- the true Java class of this (Ruby) object
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKey
in interfaceMap
-
containsValue
- Specified by:
containsValue
in interfaceMap
-
get
-
put
-
remove
-
putAll
-
clear
public void clear() -
equals
Description copied from class:RubyObject
This override does not do a "checked" dispatch.- Specified by:
equals
in interfaceMap
- Overrides:
equals
in classRubyObject
- Parameters:
other
- object to compare- Returns:
- true if equals
- See Also:
-
keySet
-
directKeySet
-
values
-
directValues
-
entrySet
-
directEntrySet
-
isComparedByIdentity
public boolean isComparedByIdentity()Is this object compared by identity or not? Shortcut for doing getFlag(COMPARE_BY_IDENTITY_F).- Returns:
- true if this object is compared by identity, false otherwise
-
setComparedByIdentity
public void setComparedByIdentity(boolean comparedByIdentity) Sets whether this object is compared by identity or not. Shortcut for doing setFlag(COMPARE_BY_IDENTITY_F, frozen).- Parameters:
comparedByIdentity
- should this object be compared by identity?
-
isRuby2KeywordHash
public boolean isRuby2KeywordHash() -
setRuby2KeywordHash
public void setRuby2KeywordHash(boolean value) -
aset
Deprecated, for removal: This API element is subject to removal in a future version.use RubyHash.op_aset insteadNote: this is included as a compatibility measure for AR-JDBC -
aref
Deprecated, for removal: This API element is subject to removal in a future version.use RubyHash.op_aref insteadNote: this is included as a compatibility measure for Mongrel+JRuby -
op_aset
Deprecated. -
each_pair
Deprecated. -
each_pairCommon
Deprecated. -
visitAll
Deprecated. -
default_value_get
Deprecated.rb_hash_default -
internalPutSmall
@Deprecated protected void internalPutSmall(IRubyObject key, IRubyObject value, boolean checkForExisting) Deprecated. -
to_a
Deprecated.- Overrides:
to_a
in classRubyBasicObject
-
default_value_set
Deprecated. -
default_proc
Deprecated. -
set_default_proc
Deprecated. -
rb_size
Deprecated. -
empty_p
Deprecated. -
rehash
Deprecated. -
to_hash
Deprecated. -
rb_values
Deprecated. -
rb_clear
Deprecated. -
any_p
Deprecated. -
initialize
Deprecated.
-