blob: 81d180caa46db22211efcd29048a783687995c2b (
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
using Mammoth.Couscous.java.lang;
using Mammoth.Couscous.java.util;
namespace Mammoth.Couscous.java.util {
internal class ArrayList<T> : List<T> {
private readonly System.Collections.Generic.IList<T> _list;
internal ArrayList() : this(new System.Collections.Generic.List<T>()) {
}
internal ArrayList(System.Collections.Generic.IList<T> list) {
_list = list;
}
internal ArrayList(List<T> list) : this(new System.Collections.Generic.List<T>(FromJava.IterableToEnumerable(list))) {
}
public Iterator<T> iterator() {
return ToJava.EnumeratorToIterator(_list.GetEnumerator());
}
public bool isEmpty() {
return _list.Count == 0;
}
public int size() {
return _list.Count;
}
public bool contains(object value) {
return value is T && _list.Contains((T) value);
}
public T get(int index) {
if (index < 0 || index >= _list.Count) {
throw new IndexOutOfBoundsException();
} else {
return _list[index];
}
}
public void add(T value) {
_list.Add(value);
}
public T remove(int index) {
T value = _list[index];
_list.RemoveAt(index);
return value;
}
public void set(int index, T value) {
_list[index] = value;
}
}
}
|