The Java Collections Framework Revisited

Projects

6.30

Rewrite the LinkedStack class from scratch so that it holds primitive ints. The ListNode class must also be altered. (This revised LinkedStack is more efficient than the general-purpose one, because it doesn't have to follow references or create instances of the Integer class.)

6.31

Implement the Deque interface from Problem 4.18. Write it from scratchdon't extend one of the classes from the Java collections framework. (Hint: Use a doubly linked list.)

6.32

Devise and write code for an efficient List implementation where elements are always inserted in groups of five and are never removed.

6.33

Write a DoublyLinkedList class which implements List but uses DoublyLinkedNodes. Use two interfaces, Predecessor and Successor. (Hint: The prev field of the first node and the next field of the last node should refer back to the DoublyLinkedList.)

Категории