SSD2015/Stack

Type 2 : Can still push when stack reach its capacity

Closed this issue · 1 comments

    for(int i=0; i < stack.capacity(); i++) {
        stack.push("dummy");
    }
    String obj = new String("WTF");
    stack.push(obj);
    assertEquals(obj, stack.peek());

expected : assertEquals(obj, stack.peek()); return false
actual : assertEquals(obj, stack.peek()); return true

Good example but not complete.
What is "stack" and how was it created?
What if capacity is -1 (infinite stack)?