My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
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
40
41
42
43
44
package com.sibirjak.asperform.collectiontests.examples.map {
import flash.utils.Dictionary;

public class MapRaw {

public var map : Dictionary;
public var stringMap : Object;
public var size : uint;

public function MapRaw() {
map = new Dictionary();
stringMap = new Object();
}

public function add(key : *, item : *) : void {
if (key is String) {
stringMap[key] = item;
} else {
map[key] = item;
}
size++;
}

public function hasKey(key : *) : Boolean {
if (key is String) {
return stringMap[key] !== undefined;
} else {
return map[key] !== undefined;
}
}

public function removeKey(key : *) : void {
if (key is String) {
if (stringMap[key] === undefined) return;
delete stringMap[key];
} else {
if (map[key] === undefined) return;
delete map[key];
}
size--;
}

}
}

Change log

r8 by jens.struwe on Apr 28, 2010   Diff
[DEV] Ordered map and treap example
Go to: 
Project members, sign in to write a code review

Older revisions

r7 by jens.struwe on Apr 28, 2010   Diff
[DEV] Map example
All revisions of this file

File info

Size: 870 bytes, 44 lines
Powered by Google Project Hosting