Advertisement
Guest User

Untitled

a guest
Apr 21st, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. /*
  2. * Incomplete Driver for ArrayList(ObjectList), Stack and Queue
  3. *
  4. *
  5. */
  6.  
  7. public class ArrayBasedDataStructuresDriver {
  8.  
  9. public static void main(String[] args) {
  10. stackTests();
  11. queueTests();
  12. arrayListTests();
  13. }
  14.  
  15. private static void arrayListTests() {
  16. //todo: make more tests here
  17. ArrayList a = new ArrayList();
  18.  
  19. a.insert('B', 0);
  20. a.insert('a',0);
  21. a.insert('t',1);
  22.  
  23. System.out.println(a.toString());
  24.  
  25. while(a.isEmpty() == false) {
  26. System.out.println(a.remove(0));
  27. }
  28.  
  29. }
  30.  
  31. private static void queueTests() {
  32. //todo: make more tests here
  33. Queue a = new Queue();
  34.  
  35. a.enqueue('B');
  36. a.enqueue('a');
  37. a.enqueue('t');
  38.  
  39. System.out.println(a.toString());
  40.  
  41. while(a.isEmpty() == false) {
  42. System.out.println(a.dequeue());
  43. }
  44.  
  45. }
  46.  
  47. private static void stackTests() {
  48. //todo: make more tests here
  49. Stack a = new Stack();
  50.  
  51. a.push('B');
  52. a.push('a');
  53. a.push('t');
  54.  
  55. System.out.println(a.toString());
  56.  
  57. while(a.isEmpty() == false) {
  58. System.out.println(a.pop());
  59. }
  60. }
  61.  
  62.  
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement