export class Stack { private _items:Array = []; public clear():void { this._items.length = 0; } public size(): number { return this._items.length; } public isEmpty(): boolean { return this.size() === 0; } public push(value: TData): void { this._items.push(value); } public pop(): TData { return this._items.pop(); } public peek(): TData { if (this.isEmpty()) { return null; } return this._items[this.size() - 1]; } public get(index:number): TData { if (index < 0 || index >= this.size()) { return null; } return this._items[index]; } }