Return to Coding in Java with artEoz – exercises

LinkedList iterator

  1. Make sure you have the geometrie resource. If necessary, see the Resources import webpage.
  2. The code below creates a list with some points. Which statement uses the iterator attached to this list? key_48
  1. What is the name of the LinkedList iterator? key_48
  2. How many attributes are provided for the representation of a LinkedList iterator? key_48
    What is the name of the one which gives access to the list of items? key_48
  3. Using the iterator, what is the statement which get the first item of the list? key_48
  4. What are the lastReturned, next et nextIndex attributes of the iterator? key_48
  5. What test shows whether the iterator still provides a list item? key_48
  6. Write an iteration that displays all the elements of the list, using an iterator. key_48
    Select the step-by-step option to check the evolution of the ListItr attributes.
  7. Make sure that the behavior of your iteration is similar to the one given below, which explicitly uses the iterator and associated functions. Select the step-by-step option to understand the behavior of the iterator.