25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HUE_06_Generics.java 1.2 KiB

1234567891011121314151617181920212223242526272829303132
  1. /************************************************
  2. * Name: David Wurm
  3. * Datum: 25.11.2019
  4. * Klasse: 3AHIF
  5. * Programm: HUE_06_GenericsQueue
  6. ************************************************/
  7. import java.util.Queue;
  8. public class HUE_06_Generics {
  9. public static void main(String[] args) {
  10. Queue<String> strs = new ChainQueue<String>();
  11. // implement null-tests
  12. System.out.println(strs.poll()); // should be null
  13. System.out.println(strs.size()); // should be 0
  14. strs.add("hallo1");
  15. strs.add("hallo2");
  16. strs.add("hallo3");
  17. System.out.println("Contains: " + strs.contains("hallo1"));
  18. System.out.println("Contains: " + strs.contains("hallo4"));
  19. System.out.println(" - " + strs.poll() + " #" + strs.size());
  20. System.out.println("Contains: " + strs.contains("hallo1"));
  21. System.out.println("Contains: " + strs.contains("hallo4"));
  22. System.out.println(" - " + strs.poll() + " #" + strs.size());
  23. System.out.println(" - " + strs.poll() + " #" + strs.size());
  24. System.out.println(" - " + strs.poll() + " #" + strs.size());
  25. Queue<Integer> strs2 = new ChainQueue<>();
  26. strs2.add(1);
  27. strs2.add(2);
  28. strs2.add(3);
  29. }
  30. }