diff --git a/hashmap/hashmap-1.1-tests.ts b/hashmap/hashmap-1.1-tests.ts
new file mode 100644
index 0000000000..a3e7fcced3
--- /dev/null
+++ b/hashmap/hashmap-1.1-tests.ts
@@ -0,0 +1,24 @@
+///
+
+var map : HashMap = new HashMap();
+
+map.set("foo", 123);
+
+var value : number = map.get("foo");
+
+map.has("foo");
+
+map.remove("foo");
+
+var keys : string[] = map.keys();
+
+var values : number[] = map.values();
+
+var count : number = map.count();
+
+map.forEach(function(value : number, key : string) : void {
+ console.log(key);
+ console.log(value);
+});
+
+map.clear();
diff --git a/hashmap/hashmap-1.1.d.ts b/hashmap/hashmap-1.1.d.ts
new file mode 100644
index 0000000000..c9f8581747
--- /dev/null
+++ b/hashmap/hashmap-1.1.d.ts
@@ -0,0 +1,71 @@
+// Type definitions for HashMap 1.1.0
+// Project: https://github.com/flesler/hashmap
+// Definitions by: Rafał Wrzeszcz
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+declare class HashMap {
+ /**
+ * Return value from hashmap.
+ *
+ * @param key Key.
+ * @return Value stored under given key.
+ */
+ get(key : KeyType) : ValueType;
+
+ /**
+ * Store value in hashmap.
+ *
+ * @param key Key.
+ * @param value Value.
+ */
+ set(key : KeyType, value : ValueType) : void;
+
+ /**
+ * Checks if given key exists in hashmap.
+ *
+ * @param key Key.
+ * @return Whether given key exists in hashmap.
+ */
+ has(key : KeyType) : boolean;
+
+ /**
+ * Removes given key from hashmap.
+ *
+ * @param key Key.
+ */
+ remove(key : KeyType) : void;
+
+ /**
+ * Returns all contained keys.
+ *
+ * @return List of keys.
+ */
+ keys() : KeyType[];
+
+ /**
+ * Returns all container values.
+ *
+ * @return List of values.
+ */
+ values() : ValueType[];
+
+ /**
+ * Returns size of hashmap (number of entries).
+ *
+ * @return Number of entries in hashmap.
+ */
+ count() : number;
+
+ /**
+ * Clears hashmap.
+ */
+ clear() : void;
+
+ /**
+ * Iterates over hashmap.
+ *
+ * @param callback Function to be invoked for every hashmap entry.
+ */
+ forEach(callback : (value : ValueType, key : KeyType) => void) : void;
+}
+
diff --git a/hashmap/hashmap-commonjs-tests.ts b/hashmap/hashmap-commonjs-tests.ts
new file mode 100644
index 0000000000..966d62593d
--- /dev/null
+++ b/hashmap/hashmap-commonjs-tests.ts
@@ -0,0 +1,41 @@
+///
+
+import HashMap = require("hashmap");
+
+var emptyMap:HashMap = new HashMap();
+var filledMap:HashMap = new HashMap("bar", 123, "bar2", 234);
+var copiedMap:HashMap = new HashMap(filledMap);
+
+emptyMap.set("foo", 123);
+emptyMap.set("foo", 123).set("foo2", 234);
+emptyMap.multi("foo3", 345, "foo4", 456).multi("foo5", 567, "foo6", "678");
+emptyMap.copy(filledMap).copy(copiedMap);
+
+var value:number = emptyMap.get("foo");
+
+var hasFoo:boolean = emptyMap.has("foo");
+
+var key:string = emptyMap.search(567);
+
+emptyMap.remove("foo").remove("foo2");
+
+var keys:string[] = emptyMap.keys();
+
+var values:number[] = emptyMap.values();
+
+var count:number = emptyMap.count();
+
+var clonedMap:HashMap = emptyMap.clone();
+
+emptyMap
+ .forEach(function (value:number, key:string):void {
+ console.log(key);
+ console.log(value);
+ })
+ .forEach(function (value:number, key:string):void {
+ console.log("Chained");
+ console.log(key);
+ console.log(value);
+ });
+
+emptyMap.clear().set("foo", 123);
diff --git a/hashmap/hashmap-tests.ts b/hashmap/hashmap-tests.ts
index 4c3d74ee00..ff9f69529b 100644
--- a/hashmap/hashmap-tests.ts
+++ b/hashmap/hashmap-tests.ts
@@ -1,24 +1,39 @@
///
-var map : HashMap = new HashMap();
+var emptyMap:HashMap = new HashMap();
+var filledMap:HashMap = new HashMap("bar", 123, "bar2", 234);
+var copiedMap:HashMap = new HashMap(filledMap);
-map.set("foo", 123);
+emptyMap.set("foo", 123);
+emptyMap.set("foo", 123).set("foo2", 234);
+emptyMap.multi("foo3", 345, "foo4", 456).multi("foo5", 567, "foo6", "678");
+emptyMap.copy(filledMap).copy(copiedMap);
-var value : number = map.get("foo");
+var value:number = emptyMap.get("foo");
-map.has("foo");
+var hasFoo:boolean = emptyMap.has("foo");
-map.remove("foo");
+var key:string = emptyMap.search(567);
-var keys : string[] = map.keys();
+emptyMap.remove("foo").remove("foo2");
-var values : number[] = map.values();
+var keys:string[] = emptyMap.keys();
-var count : number = map.count();
+var values:number[] = emptyMap.values();
-map.forEach(function(value : number, key : string) : void {
+var count:number = emptyMap.count();
+
+var clonedMap:HashMap = emptyMap.clone();
+
+emptyMap
+ .forEach(function (value:number, key:string):void {
console.log(key);
console.log(value);
-});
+ })
+ .forEach(function (value:number, key:string):void {
+ console.log("Chained");
+ console.log(key);
+ console.log(value);
+ });
-map.clear();
+emptyMap.clear().set("foo", 123);
diff --git a/hashmap/hashmap.d.ts b/hashmap/hashmap.d.ts
index c9f8581747..c209053090 100644
--- a/hashmap/hashmap.d.ts
+++ b/hashmap/hashmap.d.ts
@@ -1,24 +1,61 @@
-// Type definitions for HashMap 1.1.0
+// Type definitions for HashMap 2.0.3
// Project: https://github.com/flesler/hashmap
-// Definitions by: Rafał Wrzeszcz
+// Definitions by: Rafał Wrzeszcz , Vasya Aksyonov
// Definitions: https://github.com/borisyankov/DefinitelyTyped
-declare class HashMap {
+declare class HashMap {
+
+ /**
+ * Creates an empty hashmap.
+ */
+ constructor();
+
+ /**
+ * Creates a hashmap with the key-value pairs of map.
+ *
+ * @param map
+ */
+ constructor(map:HashMap);
+
+ /**
+ * Creates a hashmap with several key-value pairs.
+ *
+ * @param keysAndValues key1, value1, key2, value2...
+ */
+ constructor(...keysAndValues:(TKey|TValue)[]);
+
/**
* Return value from hashmap.
*
* @param key Key.
* @return Value stored under given key.
*/
- get(key : KeyType) : ValueType;
+ get(key:TKey):TValue;
/**
* Store value in hashmap.
*
* @param key Key.
* @param value Value.
+ * @return Self.
*/
- set(key : KeyType, value : ValueType) : void;
+ set(key:TKey, value:TValue):HashMap;
+
+ /**
+ * Store several key-value pairs.
+ *
+ * @param keysAndValues key1, value1, key2, value2...
+ * @return Self.
+ */
+ multi(...keysAndValues:(TKey|TValue)[]):HashMap;
+
+ /**
+ * Copy all key-value pairs from other to this instance.
+ *
+ * @param map Other map.
+ * @return Self.
+ */
+ copy(map:HashMap):HashMap;
/**
* Checks if given key exists in hashmap.
@@ -26,46 +63,68 @@ declare class HashMap {
* @param key Key.
* @return Whether given key exists in hashmap.
*/
- has(key : KeyType) : boolean;
+ has(key:TKey):boolean;
+
+ /**
+ * Returns key under which given value is stored.
+ *
+ * @param value Value.
+ * @return Key which is assigned to value stored.
+ */
+ search(value:TValue):TKey;
/**
* Removes given key from hashmap.
*
* @param key Key.
+ * @return Self.
*/
- remove(key : KeyType) : void;
+ remove(key:TKey):HashMap;
/**
* Returns all contained keys.
*
* @return List of keys.
*/
- keys() : KeyType[];
+ keys():TKey[];
/**
* Returns all container values.
*
* @return List of values.
*/
- values() : ValueType[];
+ values():TValue[];
/**
* Returns size of hashmap (number of entries).
*
* @return Number of entries in hashmap.
*/
- count() : number;
+ count():number;
/**
* Clears hashmap.
+ *
+ * @return Self.
*/
- clear() : void;
+ clear():HashMap;
+
+ /**
+ * Creates a new hashmap with all the key-value pairs of the original
+ *
+ * @return New hashmap.
+ */
+ clone():HashMap;
/**
* Iterates over hashmap.
*
* @param callback Function to be invoked for every hashmap entry.
+ * @return Self.
*/
- forEach(callback : (value : ValueType, key : KeyType) => void) : void;
+ forEach(callback:(value:TValue, key:TKey) => void):HashMap;
}
+declare module "hashmap" {
+ export = HashMap;
+}