Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Stack implements Selectable {
- private Table tablica;
- private int stan=0;
- public Stack() {
- tablica = new Table();
- }
- public Selector getSelector() {
- return tablica;
- }
- void add(String a) {
- tablica.table[stan++] = a;
- }
- class Table implements Selector {
- final int TABLE_SIZE = 100;
- public String table[] = new String[TABLE_SIZE];
- public int current = 0;
- public boolean end() {
- return (table[current] == null);
- }
- public Object getCurrent() {
- return (table[current]);
- }
- public void next() {
- if (end())
- throw new NoSuchElementException();
- else
- current++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement