blob: df5447d91d45c24f303872188f9a366653043dda (
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
|
namespace Mammoth.Couscous.java.util {
internal class ArrayDeque<T> : Deque<T> {
private readonly System.Collections.Generic.IList<T> _list = new System.Collections.Generic.List<T>();
public int size() {
return _list.Count;
}
public T getFirst() {
if (_list.Count > 0) {
return _list[0];
} else {
throw new NoSuchElementException();
}
}
public T getLast() {
if (_list.Count > 0) {
return _list[_list.Count - 1];
} else {
throw new NoSuchElementException();
}
}
public void add(T value) {
_list.Add(value);
}
public T removeLast() {
T value = getLast();
_list.RemoveAt(_list.Count - 1);
return value;
}
}
}
|