1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package com.googlecode.mgwt.collection.shared;
17
18 import com.google.gwt.core.client.GWT;
19 import com.googlecode.mgwt.collection.client.JsLightArray;
20 import com.googlecode.mgwt.collection.client.JsLightArrayInteger;
21 import com.googlecode.mgwt.collection.client.JsLightMap;
22 import com.googlecode.mgwt.collection.shared.java.JavaLightArray;
23 import com.googlecode.mgwt.collection.shared.java.JavaLightArrayInt;
24 import com.googlecode.mgwt.collection.shared.java.JavaLightMap;
25
26
27
28
29
30
31
32
33
34
35 public class CollectionFactory {
36
37
38
39
40
41
42 public static <V> LightMap<V> constructMap() {
43 if (GWT.isProdMode()) {
44 return new JsLightMap<V>();
45 } else {
46 return new JavaLightMap<V>();
47 }
48 }
49
50
51
52
53
54
55
56 public static <V> LightArray<V> constructArray() {
57 if (GWT.isProdMode()) {
58 return new JsLightArray<V>();
59 } else {
60 return new JavaLightArray<V>();
61 }
62 }
63
64
65
66
67
68
69 public static LightArrayInt constructIntegerArray() {
70 if (GWT.isProdMode()) {
71 return new JsLightArrayInteger();
72 } else {
73 return new JavaLightArrayInt();
74 }
75 }
76 }