Clear Up
SharpKit Reference

HashMap Class

Namespace: Ext.util

Base Types

System.Object

Constructors

Name Description
HashMap()
HashMap(HashMapConfig)
HashMap(object) Creates new HashMap. @param {Object} config The configuration options

Methods

Name Description
add(JsString, object) Add a new item to the hash. An exception will be thrown if the key already exists. @param {String} key The key of the new item. @param {Object} value The value of the new item. @return {Object} The value of the new item added.
clear(object) private
clone() Performs a shallow copy on this hash. @return {Ext.util.HashMap} The new hash object.
contains(object) Checks whether a value exists in the hash. @param {Object} value The value to check for. @return {Boolean} True if the value exists in the dictionary.
containsKey(JsString) Checks whether a key exists in the hash. @param {String} key The key to check for. @return {Boolean} True if they key exists in the hash.
each(JsAction, object) Executes the specified function once for each item in the hash. Returning false from the function will cease iteration. * The paramaters passed to the function are:
  • key : String

    The key of the item

  • value : Number

    The value of the item

  • length : Number

    The total number of items in the hash

@param {Function} fn The function to execute. @param {Object} scope The scope to execute in. Defaults to this. @return {Ext.util.HashMap} this
findKey(object) @private Find the key for a value. @param {Object} value The value to find. @return {Object} The value of the item. Returns undefined if not found.
get(JsString) Retrieves an item with a particular key. @param {String} key The key to lookup. @return {Object} The value at that key. If it doesn't exist, undefined is returned.
getArray(bool) Gets either the keys/values in an array from the hash. @private @param {Boolean} isKey True to extract the keys, otherwise, the value @return {Array} An array of either keys/values from the hash.
getCount() Gets the number of items in the hash. @return {Number} The number of items in the hash.
getData(JsString, object) Implementation for being able to extract the key from an object if only a single argument is passed. @private @param {String} key The key @param {Object} value The value @return {Array} [key, value]
getKey(object) Extracts the key from an object. This is a default implementation, it may be overridden @private @param {Object} o The object to get the key from @return {String} The key to use.
getKeys() Return all of the keys in the hash. @return {Array} An array of keys.
getValues() Return all of the values in the hash. @return {Array} An array of values.
remove(object) Remove an item from the hash. @param {Object} o The value of the item to remove. @return {Boolean} True if the item was successfully removed.
removeByKey(JsString) Remove an item from the hash. @param {String} key The key to remove. @return {Boolean} True if the item was successfully removed.
replace(JsString, object) Replaces an item in the hash. If the key doesn't exist, the {@link #add} method will be used. @param {String} key The key of the item. @param {Object} value The new value for the item. @return {Object} The new value of the item.

Properties

Name Description
Count Gets the number of items in the hash. @return {Number} The number of items in the hash.
Keys Return all of the keys in the hash. @return {Array} An array of keys.
Values Return all of the values in the hash. @return {Array} An array of values.
© Copyright 2005-2011 SharpKit. All rights reserved.