logo

CuriousTab

CuriousTab

Discussion


Home Interview Technology Comments

  • Question
  • How do you traverse through a collection using its Iterator?


  • Correct Answer
  • To use an iterator to traverse through the contents of a collection, follow these steps: - Obtain an iterator to the start of the collection by calling the collections iterator() method - Set up a loop that makes a call to hasNext() Have the loop iterate as long as hasNext() returns true - Within the loop, obtain each element by calling next() 


  • Technology problems


    Search Results


    • 1. When should I use abstract classes and when should I use interfaces?
    • Discuss
    • 2. Explain Overriding Polymorphism.?
    • Discuss
    • 3. When do you use :: Operator in C++?
    • Discuss
    • 4. What is polymorphism?
    • Discuss
    • 5. What is JAR file?
    • Discuss
    • 6. How do you decide when to use ArrayList and When to use LinkedList?
    • Discuss
    • 7. What is the Set interface ?
    • Discuss
    • 8. What is the SimpleTimeZone class?
    • Discuss
    • 9. What are Native methods in Java?
    • Discuss
    • 10. What is Auto boxing and unboxing?
    • Discuss


    Comments

    There are no comments.

Enter a new Comment