summaryrefslogtreecommitdiff
path: root/js/src/Ice/HashMap.d.ts
blob: ae3056f690fb00817caf8415d2626a0424ab4b31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//

declare module "ice"
{
    namespace Ice
    {
        type HashMapKey = number | string | boolean |
            {
                equals(other: any):boolean;
                hashCode():number
            };

        class HashMap<Key extends HashMapKey, Value>
        {
            constructor();
            constructor(other:HashMap<Key, Value>);
            constructor(keyComparator: (k1:Key, k2:Key) => boolean,
                        valueComparator?: (v1:Value, v2:Value) => boolean);

            set(key:Key, value:Value):void;
            get(key:Key):Value|undefined;
            has(key:Key):boolean;
            delete(key:Key):Value|undefined;
            clear():void;
            forEach(fn:(value:Value, key:Key)=>void, thisArg?:Object):void;

            entries(): IterableIterator<[Key, Value]>;
            keys(): IterableIterator<Key>;
            values(): IterableIterator<Value>;

            equals(other: HashMap<Key, Value>, valueComparator?: (v1:Value, v2:Value) => boolean): boolean;
            merge(from: HashMap<Key, Value>):void;

            readonly size:number;
        }
    }
}