References


Self-Test Questions

1. 

What’s the purpose of the Java collections framework?

image from book

2. 

Into what four primary areas is the Java collections framework organized?

 - interfaces, implementation classes, algorithms, infrastructure

3. 

What are the six core collection interfaces offered in the Java platform version 1.4.2 collections framework?

-collection, list, set, sortedset, map, sortedmap

4. 

Describe the performance characteristics of a linked list.

5. 

Describe the performance characteristics of a hashtable.

image from book

6. 

Describe the performance characteristics of a red-black tree.

image from book

7. 

What’s the purpose of an Iterator?

 - allows you to remove elements from a collection using the remove() method.

8. 

Describe the fundamental differences between the Java 5 collections framework and previous collections framework versions.

image from book

9. 

What’s the difference between an Iterator and a ListIterator?

image from book

10. 

When would you chose to iterate over the elements of a Java 5 collection using the enhanced for loop vs. an ordinary for loop and an Iterator?

 - when you don t want to remove elements from the collection.

Answers

1. 

- Provides a comprehensive API for collections management. Java developers learn one API and their collection manipulation code is guaranteed to work across deployment platforms.

2. 

- interfaces, implementation classes, algorithms, infrastructure

3. 

-Collection, List, Set, SortedSet, Map, SortedMap

4. 

- List elements can reside anywhere in memory and are accessed via next and previous pointers.

5. 

- Elements are inserted into position according to an object’s hashcode. Object’s with the same hashcode will be appended to a linked list at the element position.

6. 

- A red-black tree is self-sorting and self-balancing. Leaf nodes are always the same number of black nodes away from the root element.

7. 

- Allows you to remove elements from a collection using the remove() method.

8. 

- Java 5 collections introduced generics and several new interface and implementation classes. The enhanced for loop enables you to iterate over a collection without explicitly declaring and using an Iterator.

9. 

- An iterator moves forward through a collection’ s elements; a ListIterator moves forward and backward.

10. 

- When you don’t want to remove elements from the collection.




Java For Artists(c) The Art, Philosophy, and Science of Object-Oriented Programming
Java For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
ISBN: 1932504052
EAN: 2147483647
Year: 2007
Pages: 452

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net