Return to Coding in Java with artEoz – exercises

ArrayList 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. Memory diagram of an iterator displays 4 attributes. What is the name of the one which gives access to the list of items? key_48
  2. Using the iterator, what is the statement which get the first item of the list key_48
  3. What is the cursor attribute of the iterator? key_48
  4. What test shows whether the iterator still provides a list item? key_48
  5. 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 cursor attribute.
  6. 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.