Procházet zdrojové kódy

removed unnecessary lines and added header

master
David před 4 roky
rodič
revize
57d3c08518
2 změnil soubory, kde provedl 12 přidání a 8 odebrání
  1. +6
    -6
      src/ChainQueue.java
  2. +6
    -2
      src/HUE_06_Generics.java

+ 6
- 6
src/ChainQueue.java Zobrazit soubor

@@ -1,12 +1,15 @@
/************************************************
* Name: David Wurm
* Datum: 25.11.2019
* Klasse: 3AHIF
* Programm: HUE_06_GenericsQueue
************************************************/
import java.util.Collection;
import java.util.Iterator;
import java.util.Queue;


public class ChainQueue<E> implements Queue<E> {

private class Node<E> {

private E data;
private Node<E> next;

@@ -30,7 +33,6 @@ public class ChainQueue<E> implements Queue<E> {
this.data = data;

}

}

Node<E> first; // first item of the queue
@@ -42,7 +44,6 @@ public class ChainQueue<E> implements Queue<E> {
return true;
}
return addNode(input, first); // no? -> goto addNode()

}

private boolean addNode(E input, Node n) { // run through the queue and find the first "place" which is empty
@@ -51,7 +52,6 @@ public class ChainQueue<E> implements Queue<E> {
return true;
}
return addNode(input, n.getNext());

}

@Override


+ 6
- 2
src/HUE_06_Generics.java Zobrazit soubor

@@ -1,5 +1,10 @@
/************************************************
* Name: David Wurm
* Datum: 25.11.2019
* Klasse: 3AHIF
* Programm: HUE_06_GenericsQueue
************************************************/
import java.util.Queue;

public class HUE_06_Generics {
public static void main(String[] args) {
Queue<String> strs = new ChainQueue<String>();
@@ -14,6 +19,5 @@ public class HUE_06_Generics {
System.out.println(" - " + strs.poll() + " #" + strs.size());
System.out.println(" - " + strs.poll() + " #" + strs.size());
System.out.println(" - " + strs.poll() + " #" + strs.size());

}
}

Načítá se…
Zrušit
Uložit