Time for an 2014 update…

This commit is contained in:
Ingy döt Net 2014-01-17 05:32:22 +00:00
parent 372c577f83
commit 09687c4926
2520 changed files with 34227 additions and 7318 deletions

View file

@ -1,27 +1,27 @@
public class Stack<T>{
public class Stack{
private Node first = null;
public boolean isEmpty(){
return first == null;
}
public T Pop(){
public Object Pop(){
if(isEmpty())
throw new Exception("Can't Pop from an empty Stack.");
else{
T temp = first.value;
Object temp = first.value;
first = first.next;
return temp;
}
}
public void Push(T o){
public void Push(Object o){
first = new Node(o, first);
}
class Node{
public Node next;
public T value;
public Node(T value){
public Object value;
public Node(Object value){
this(value, null);
}
public Node(T value, Node next){
public Node(Object value, Node next){
this.next = next;
this.value = value;
}