Answer the following statements true (T) or false (F)

1) Using the hasNext() and next() methods in a loop is the only way to retrieve all of the list elements using an iterator.
2) A user may not be able to predict the order in which an iterator will return elements from a collection
3) ‘Fail-fast’ means that a program will crash if a collection class supports the Iterable interface but no Iterator object is created.
4) An iterator’s remove method requires the use of a for-each loop.
5) When a user writes code to implement a collection class that implements the Iterable interface, they have to write code
for the next and hasNext methods.


1) F
2) T
3) F
4) F
5) F

Computer Science & Information Technology

You might also like to view...

What is wrong with this code?

``` float CalcCost( int unit ) { float cost; cost = 5.59 * unit; return cost; } ``` A. The function name is invalid. B. The return type should be int. C. You can’t have math statements inside a function. D. Nothing is wrong with it.

Computer Science & Information Technology

Work that is no longer protected by copyright is in the ____________________, which means anyone can use it however they wish for any purpose.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

A(n) ___________________ is an online community such as Facebook, LinkedIn, or Twitter that encourages members to share their interests, stories, photos, music, and videos with other members.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

What operation dos the following BST algorithm describe?Algorithm aBSTAlgorithm (root)   if (right subtree empty)      return (root)   end if   return aBSTAlgorithm (right subtree)end aBSTAlgorithm

A. inorder traversal B. find the smallest node C. find the largest node D. find a requested node

Computer Science & Information Technology