52 lines
1.0 KiB
Java
52 lines
1.0 KiB
Java
package com.xgiovio;
|
|
|
|
import general_utility.test_object;
|
|
import stack.ArrayStack;
|
|
import stack.NodeStack;
|
|
|
|
/**
|
|
* Created with xgiovio.macbookair.
|
|
* User: xgiovio
|
|
* Date: 23/03/14
|
|
* Time: 20:37
|
|
*/
|
|
public class ArrayTest {
|
|
|
|
public static void main(String[] args) {
|
|
NodeStack<test_object> a = new NodeStack<test_object>();
|
|
System.out.print(a.isEmpty());
|
|
a.push(new test_object(10));
|
|
System.out.print(a.size());
|
|
a.push(new test_object(20));
|
|
System.out.print(a.size());
|
|
a.push(new test_object(30));
|
|
System.out.print(a.size());
|
|
a.push(new test_object(40));
|
|
System.out.print(a.size());
|
|
|
|
|
|
|
|
a.pop();
|
|
System.out.print(a.size());
|
|
a.pop();
|
|
System.out.print(a.size());
|
|
|
|
|
|
System.out.print(a.toString());
|
|
|
|
a.push(new test_object(50));
|
|
a.push(new test_object(60));
|
|
|
|
System.out.print(a.toString());
|
|
a.pop();
|
|
System.out.print(a.toString());
|
|
System.out.print(a.top().toString());
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|