- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
package brakets;
import java.util.ArrayList;
import java.util.List;
public class CommonStack<T> {
private final List<T> items = new ArrayList<T>();
private int position = -1;
public void push(T newEl) {
items.add(newEl);
position++;
}
public T pop() {
if (position >= 0) {
T b = items.get(position);
items.remove(position);
position--;
return b;
}
return null;
}
@Override
public String toString() {
return "CommonStack [items=" + items + ", position=" + position + "]";
}
public boolean hasNext() {
return position >= 0;
}
}
bober_maniac 22.01.2012 01:43 # −3
pingw33n 22.01.2012 12:49 # 0
3.14159265 23.01.2012 16:19 # 0
Lure Of Chaos 23.01.2012 18:48 # 0
eth0 23.01.2012 19:14 # 0
SmackMyBitchUp 23.01.2012 20:22 # 0