Sunday, September 18, 2011

java collections interview questions

  • What is Iterator and ListIterator in Java ?
Iterator in Java is used to traverse object inside a collection.
 Java Iterator allows you to easily access object stored in Collection.
List Iterator is bidirectional navigation technique.

  • What is the Vector class?
The Vector class provides the capability to implement a growable array of objects.

  • What is an Iterator interface?
The Iterator interface is used to step through the elements of a Collection

  • What are the main implementations of the List interface ?

The main implementations of the List interface are as follows :
ArrayList : Resizable-array implementation of the List interface.
 The best all-around implementation of the List interface.

Vector : Synchronized resizable-array implementation of the List interface with additional "legacy methods."

LinkedList : Doubly-linked list implementation of the List interface.
May provide better performance than the ArrayList implementation if elements are frequently inserted or deleted within the list.
Useful for queues and double-ended queues (deques).


http://www.allapplabs.com/interview_questions/java_collection_interview_questions.htm

No comments:

Post a Comment