Java SE 8 API documentation

Last modification: 06/12/16

  1. The Direction enumeration

    Create en enumeration which includes a LEFT and a RIGHT value.

    Override the toString() method such as it returns left and right accordingly.

  2. The ZipList data structure

    Create a new class named ZipList which can store arbitary elements (it is a generic data structure). A ZipList represents a regular list with a focus on a given element. We can move the focus to the left or right one step using the Direction enumeration.

    1. Create a constructor which takes a List<A> as argument and inicializes two lists: a list with elements left and right of the focus. The first element of the right list is at the focus.

    2. Add a move() method which takes a Direction as argument and moves the focus in the given direction.

    3. Add a get() method which retrieves the element in the focus.

    4. Add a put() element which takes a new element as argument an places it in the focus.

  3. The NoMoreElementException unchecked exception

    Create an unchecked exception NoMoreElementException (it inherits from RuntimeException).

    Modify your move() method such as it throws an exception when we want to step out of the list with the focus.

  4. The EmptyFocusException checked exception

    Create a checked exception EmptyFocusException (it inherits from Exception).

    Modify your get() method such as it throws an exception when we want to get an element from an empty list.