Mercurial > projects > dwt2
annotate base/src/java/util/HashSet.d @ 27:1bf55a6eb092
Renamed java tree to base
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 21 Mar 2009 11:33:57 +0100 |
parents | java/src/java/util/HashSet.d@9b96950f2c3c |
children | af948d4bbf8c |
rev | line source |
---|---|
10
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
1 module java.util.HashSet; |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
2 |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
3 import java.lang.all; |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
4 import java.util.Set; |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
5 import java.util.Collection; |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
6 import java.util.Iterator; |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
7 |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
8 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
9 static import tango.util.container.HashSet; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
10 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
11 } |
10
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
12 |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
13 class HashSet : Set { |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
14 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
15 alias tango.util.container.HashSet.HashSet!(Object) SetType; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
16 private SetType set; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
17 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
18 } |
10
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
19 |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
20 public this(){ |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
21 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
22 set = new SetType(); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
23 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
24 implMissing( __FILE__, __LINE__ ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
25 } |
10
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
26 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
27 public this(Collection c){ |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
28 implMissing( __FILE__, __LINE__ ); |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
29 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
30 public this(int initialCapacity){ |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
31 implMissing( __FILE__, __LINE__ ); |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
32 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
33 public this(int initialCapacity, float loadFactor){ |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
34 implMissing( __FILE__, __LINE__ ); |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
35 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
36 public bool add(Object o){ |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
37 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
38 return set.add(o); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
39 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
40 implMissing( __FILE__, __LINE__ ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
41 return false; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
42 } |
10
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
43 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
44 public bool add(String o){ |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
45 return add(stringcast(o)); |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
46 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
47 public bool addAll(Collection c){ |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
48 implMissing( __FILE__, __LINE__ ); |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
49 return false; |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
50 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
51 public void clear(){ |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
52 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
53 set.clear(); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
54 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
55 implMissing( __FILE__, __LINE__ ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
56 } |
10
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
57 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
58 public bool contains(Object o){ |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
59 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
60 return set.contains(o); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
61 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
62 implMissing( __FILE__, __LINE__ ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
63 return false; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
64 } |
10
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
65 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
66 public bool contains(String o){ |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
67 return contains(stringcast(o)); |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
68 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
69 public bool containsAll(Collection c){ |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
70 implMissing( __FILE__, __LINE__ ); |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
71 return false; |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
72 } |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
73 public override equals_t opEquals(Object o){ |
10
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
74 implMissing( __FILE__, __LINE__ ); |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
75 return 0; |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
76 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
77 public override hash_t toHash(){ |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
78 implMissing( __FILE__, __LINE__ ); |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
79 return 0; |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
80 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
81 public bool isEmpty(){ |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
82 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
83 return set.isEmpty(); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
84 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
85 implMissing( __FILE__, __LINE__ ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
86 return false; |
10
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
87 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
88 } |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
89 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
90 class LocalIterator : Iterator { |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
91 SetType.Iterator iter; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
92 Object nextElem; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
93 this( SetType.Iterator iter){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
94 this.iter = iter; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
95 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
96 public bool hasNext(){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
97 return iter.next(nextElem); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
98 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
99 public Object next(){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
100 return nextElem; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
101 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
102 public void remove(){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
103 iter.remove(); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
104 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
105 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
106 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
107 } |
10
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
108 public Iterator iterator(){ |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
109 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
110 return new LocalIterator(set.iterator()); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
111 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
112 implMissing( __FILE__, __LINE__ ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
113 return null; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
114 } |
10
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
115 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
116 public bool remove(Object o){ |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
117 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
118 return set.remove(o); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
119 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
120 implMissing( __FILE__, __LINE__ ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
121 return false; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
122 } |
10
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
123 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
124 public bool remove(String key){ |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
125 return remove(stringcast(key)); |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
126 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
127 public bool removeAll(Collection c){ |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
128 implMissing( __FILE__, __LINE__ ); |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
129 return false; |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
130 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
131 public bool retainAll(Collection c){ |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
132 implMissing( __FILE__, __LINE__ ); |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
133 return false; |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
134 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
135 public int size(){ |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
136 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
137 return set.size(); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
138 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
139 implMissing( __FILE__, __LINE__ ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
140 return 0; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
141 } |
10
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
142 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
143 public Object[] toArray(){ |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
144 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
145 Object[] res; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
146 res.length = size(); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
147 int idx = 0; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
148 foreach( o; set ){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
149 res[idx] = o; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
150 idx++; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
151 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
152 return res; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
153 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
154 implMissing( __FILE__, __LINE__ ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
155 return null; |
10
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
156 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
157 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
158 public Object[] toArray(Object[] a){ |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
159 implMissing( __FILE__, __LINE__ ); |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
160 return null; |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
161 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
162 public override String toString(){ |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
163 implMissing( __FILE__, __LINE__ ); |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
164 return null; |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
165 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
166 |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
167 // only for D |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
168 public int opApply (int delegate(ref Object value) dg){ |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
169 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
170 return set.opApply(dg); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
171 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
172 implMissing( __FILE__, __LINE__ ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
173 return 0; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
174 } |
10
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
175 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
176 |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
177 } |
eb8ff453285d
Added java.util collection classes.
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
178 |