Friday, January 06, 2006

Data Structure

(1) Array and ArrayList are expensive for updates (insert and remove)
any change will cause the all move of the structure
However, LinkedList resolve the issue but CiruclarArrayQueue is more efficient than LinkedList. But CircularArrayQueue is bounded. For unbound operation linkedList
is better
(2) LinkedList is different from common Collection. It is ordered collection.

(3) ListIterator has add(), previous and hasPrevious cursor type methods which
Iterator does not have LinkedList does not have either

ListIterator has traversing features

(4) 2 protocols to access Collection

get and set
Iterator and ListInterator

get and set fits Arrays

(5) HashSet Hashtable HashMap for fast access unorder strcuture without knowing location LinkedList is for order structure with known position
TreeSet improved as sorted collection
(6)LinkedHashset, LinkedHashMap improved by ordering
LinkedHashMap is the perfect for LRU cache implemenation
since it is by accessing order instead of insert order

(6) Collection views

lighweight wrapper view

asList();
nCopies();

Subranges view for numbers

subList, subMap

Unmodifiable Views

unmodifiableList

Synchronized View is limited better to used CocurrentHashMap()

Checked View for debug

No comments: