X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/0494b8d9b9bb03ab6c22b34dae81261e3cd7e3e6..7a654f8d43fdb43d78b63d90528bed6e86b608cc:/docs/api/Ext.util.HashMap.html?ds=sidebyside diff --git a/docs/api/Ext.util.HashMap.html b/docs/api/Ext.util.HashMap.html new file mode 100644 index 00000000..3c477975 --- /dev/null +++ b/docs/api/Ext.util.HashMap.html @@ -0,0 +1,184 @@ +Ext.util.HashMap | Ext JS 4.0 Documentation +
For up to date documentation and features, visit +http://docs.sencha.com/ext-js/4-0

Sencha Documentation

+ + + + + +

+Represents a collection of a set of key and value pairs. Each key in the HashMap +must be unique, the same key cannot exist twice. Access to items is provided via +the key only. Sample usage: +

var map = new Ext.util.HashMap();
+map.add('key1', 1);
+map.add('key2', 2);
+map.add('key3', 3);
+
+map.each(function(key, value, length){
+    console.log(key, value, length);
+});
+
+

+ + + + +

The HashMap is an unordered class, +there is no guarantee when iterating over the items that they will be in any particular +order. If this is required, then use a Ext.util.MixedCollection. +

+ +
Defined By

Config Options

Other Configs

 
A function that is used to retrieve a default key for a passed object. +A default is provided that returns the id prop...

A function that is used to retrieve a default key for a passed object. +A default is provided that returns the id property on the object. This function is only used +if the add method is called with a single argument.

+
Defined By

Methods

 
HashMap( +Object config) + : void

 

+

Parameters

  • config : Object

    The configuration options

    +

Returns

  • void    +
 
add( +String key, Object o) + : Object

Adds an item to the collection. Fires the add event when complete.

+

Adds an item to the collection. Fires the add event when complete.

+

Parameters

  • key : String

    The key to associate with the item, or the new item.

    + + +

    If a getKey implementation was specified for this HashMap, +or if the key of the stored items is in a property called id, +the HashMap will be able to derive the key for the new item. +In this case just pass the new item in this parameter.

    + +
  • o : Object

    The item to add.

    +

Returns

  • Object   

    The item added.

    +
 
clear( +Object initial) + : Ext.util.HashMap

Removes all items from the hash.

+

Removes all items from the hash.

+

Parameters

  • initial : Object
    +

Returns

  • Ext.util.HashMap   

    this

    +
 

Performs a shallow copy on this hash.

+

Performs a shallow copy on this hash.

+

Returns

  • Ext.util.HashMap   

    The new hash object.

    +
 
contains( +Object value) + : Boolean

Checks whether a value exists in the hash.

+

Checks whether a value exists in the hash.

+

Parameters

  • value : Object

    The value to check for.

    +

Returns

  • Boolean   

    True if the value exists in the dictionary.

    +
 
containsKey( +String key) + : Boolean

Checks whether a key exists in the hash.

+

Checks whether a key exists in the hash.

+

Parameters

  • key : String

    The key to check for.

    +

Returns

  • Boolean   

    True if they key exists in the hash.

    +
 
each( +Function fn, Object scope) + : Ext.util.HashMap
Executes the specified function once for each item in the hash. +Returning false from the function will cease iteratio...

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

  • +
+ +

Parameters

  • fn : Function

    The function to execute.

    +
  • scope : Object

    The scope to execute in. Defaults to this.

    +

Returns

  • Ext.util.HashMap   

    this

    +
 
get( +String key) + : Object

Retrieves an item with a particular key.

+

Retrieves an item with a particular key.

+

Parameters

  • key : String

    The key to lookup.

    +

Returns

  • Object   

    The value at that key. If it doesn't exist, undefined is returned.

    +
 

Gets the number of items in the hash.

+

Gets the number of items in the hash.

+

Returns

  • Number   

    The number of items in the hash.

    +
 

Return all of the keys in the hash.

+

Return all of the keys in the hash.

+

Returns

  • Array   

    An array of keys.

    +
 

Return all of the values in the hash.

+

Return all of the values in the hash.

+

Returns

  • Array   

    An array of values.

    +
 
remove( +Object o) + : Boolean

Remove an item from the hash.

+

Remove an item from the hash.

+

Parameters

  • o : Object

    The value of the item to remove.

    +

Returns

  • Boolean   

    True if the item was successfully removed.

    +
 
removeAtKey( +String key) + : Boolean

Remove an item from the hash.

+

Remove an item from the hash.

+

Parameters

  • key : String

    The key to remove.

    +

Returns

  • Boolean   

    True if the item was successfully removed.

    +
 
replace( +String key, Object value) + : Object

Replaces an item in the hash. If the key doesn't exist, the +add method will be used.

+

Replaces an item in the hash. If the key doesn't exist, the +add method will be used.

+

Parameters

  • key : String

    The key of the item.

    +
  • value : Object

    The new value for the item.

    +

Returns

  • Object   

    The new value of the item.

    +
Defined By

Events

 
add( +Ext.util.HashMap this, String key, Object value) +

Fires when a new item is added to the hash

+

Fires when a new item is added to the hash

+

Parameters

  • this : Ext.util.HashMap

    .

    +
  • key : String

    The key of the added item.

    +
  • value : Object

    The value of the added item.

    +
 
clear( +Ext.util.HashMap this) +

Fires when the hash is cleared.

+

Fires when the hash is cleared.

+

Parameters

  • this : Ext.util.HashMap

    .

    +
 
remove( +Ext.util.HashMap this, String key, Object value) +

Fires when an item is removed from the hash.

+

Fires when an item is removed from the hash.

+

Parameters

  • this : Ext.util.HashMap

    .

    +
  • key : String

    The key of the removed item.

    +
  • value : Object

    The value of the removed item.

    +
 
replace( +Ext.util.HashMap this, String key, Object value, Object old) +

Fires when an item is replaced in the hash.

+

Fires when an item is replaced in the hash.

+

Parameters

  • this : Ext.util.HashMap

    .

    +
  • key : String

    The key of the replaced item.

    +
  • value : Object

    The new value for the item.

    +
  • old : Object

    The old value for the item.

    +
\ No newline at end of file