Friday, August 13, 2010

Collections

Courtesy of SCJP Sun® Certified Programmer for Java™ 6 Study Guide Exam (310-065) (9780071591065)
Chapter 7, Question 7

Which collection class(es) allows you to grow or shrink its size and provides indexed access to its elements, but whose methods are not synchronized? (Choose all that apply.)

A. java.util.HashSet

HashSet allows you to grow or shrink the size of your collection. Not synchronized.

B. java.util.LinkedHashSet

Implementation of HashSet, maintains doubly-linked list. Not synchronized.

C. java.util.List

This is an interface.

D. java.util.ArrayList

All of the collection classes allow you to grow or shrink the size of your collection. ArrayList provides an index to its elements. The newer collection classes tend not to have synchronized methods.

E. java.util.Vector

Vector is an older implementation of ArrayList functionality and has synchronized methods; it is slower than ArrayList.

F. java.util.PriorityQueue

No comments:

Post a Comment