|
1234567891011121314151617181920212223242526272829303132 |
- /************************************************
- * 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>();
- // implement null-tests
- System.out.println(strs.poll()); // should be null
- System.out.println(strs.size()); // should be 0
-
- strs.add("hallo1");
- strs.add("hallo2");
- strs.add("hallo3");
- System.out.println("Contains: " + strs.contains("hallo1"));
- System.out.println("Contains: " + strs.contains("hallo4"));
- System.out.println(" - " + strs.poll() + " #" + strs.size());
- System.out.println("Contains: " + strs.contains("hallo1"));
- System.out.println("Contains: " + strs.contains("hallo4"));
- System.out.println(" - " + strs.poll() + " #" + strs.size());
- System.out.println(" - " + strs.poll() + " #" + strs.size());
- System.out.println(" - " + strs.poll() + " #" + strs.size());
-
- Queue<Integer> strs2 = new ChainQueue<>();
- strs2.add(1);
- strs2.add(2);
- strs2.add(3);
- }
- }
|