Advertisement
Guest User

Untitled

a guest
Nov 26th, 2015
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. public void push(int zahl){
  2.     if (this.first == null)
  3.     {
  4.         // leere warteschlange
  5.         this.first = new Node(zahl, null);
  6.         // optional: wenn nicht so, dann muss else if fall geändert werden
  7.         this.last = first;              
  8.     }
  9.     else if (this.first == this.last) // alternativ, wenn oben last nicht = first gesetzt wird: this.last == null
  10.     {
  11.         this.last = new Node(zahl, null);
  12.         this.first.setNext(this.last);
  13.     }
  14.     else
  15.     {
  16.         this.last.setNext(new Node(zahl, null));
  17.     }    
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement