Java - Interview Questions and Answers for 'Iterator' | Search Java Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com
Share

Search Java Interview Questions


 2137 questions in repository.
 There are more than 200 unanswered questions.
Click here and help us by providing the answer.
Label / Company      Label / Company / Text

   



Interview Questions and Answers for 'Iterator' - 8 question(s) found - Order By Newest

Frequently asked.
  Q1. What is an Iterator?Core Java
Anonymous
Ans. Iterator is an interface that provides methods to iterate over any Collection.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   collections   iterator     Magic Software  Maverick Software  Wipro  IBM  HCL Technologies  Tata Consultancy (TCS)  Cognizant (CTS)  Wipro  Accenture      basic        frequent


 Q2. What are few iterator classes provided by Java ?
Admin
info@buggybread.com
Ans. http://www.buggybread.com/2015/01/java-iterator-classes-and-interfaces.html

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   collections   iterator


 Q3. What are fail-fast Iterators ?Core Java2016-06-09 09:27:36

Ans. Fail-fast iterators detect illegal concurrent modification during iteration and fail quickly and cleanly rather than risking arbitrary, non deterministic behavior at an undetermined time in future. Example could be of an Iterator failing if it smells ConcurrentModificationException.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     fail-fast Iterators  Iterators     Roposo  Elitecore Technologies  Google  InfoTrellis  Infosys      intermediate


 Q4. Is Iterator a class ?

Ans. No, iterator is an interface that is used to parse through the elements of a Collection

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     collections  iterator


 Q5. How Spliterator in Java 8 different than iterator ?Core Java2016-11-24 09:44:49

Ans. Though there are many differences the way internally they both iterates the collections and streams respectively, but the main difference in performance that is achieved by spliterator as it can iterate Streams in Parallel whereas iterator only iterates collections sequentially.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java8  java 8  spliterator  java 8 streams  streams


 Q6. Which is better in terms of performance - Iterator or Spliterator ?Core Java2016-11-24 09:46:26

Ans. Spliterator has better performance potential than iterators but only if the potential is used. Spliterator can iterate streams in parallel as well as in sequence whereas iterator can only iterate in sequence.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     iterator  collections  streams  parallel streams  Spliterator


 Q7. What are the cursors available in Java ?Core Java2017-01-15 14:55:22

Ans. Enumeration
Iterator
List iterator

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     cursors  iterator


 Q8. What is the difference between Enumeration and Iterator ?Core Java2017-05-07 15:22:08

Ans. Enumeration can iterate only legacy collections like Vector , HashTable and Stack whereas Iterator can iterate both legacy and non legacy collections.

Enumeration is less safer than Iterator

Enumeration is fail safe whereas Iterator is fail fast

Iterator allows for removal of element while traversal whereas Enumeration doesn't have remove method.

Enumerations were introduced in Java 1 whereas Iterators were introduced with Java 2

Enumerations have methods like hasMoreElements and nextElement whereas Iterators have methods like hasNext, next and remove

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     enumeration vs iterator  collections      Basic        frequent




Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner



comments powered by Disqus
 

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked:
         

X Close this

X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   


Questions Asked: