Class Kata „Stack“
Implement the abstract data type Stack. The stack is a first-in last-out data structure. Elements that are put on the stack are returned in reverse order. See the example below for details.
The interface has to look like the following:
public interface IStack
void Push(TElement element);
The data type has to be implemented as a generic data type where TElement is the type of the elements. The stack has two operations, Push and Pop. Push puts an element on the top of the stack whereas Pop returns the topmost element and removes it from the stack. If Pop is called on an empty stack an IllegalOperationException is thrown.
|7, 9, 1||Pop()||1|
“I am the founder of Majer Consulting and Majer Training and an experienced software developer, trainer and consultant. I have been on the road in the SAP world since 1998, supporting numerous projects, and have developed a passion for software engineering, software testing and agile development methods such as TDD. When I am not servicing customers or holding seminars, I am speaking at conferences or writing my next book.”