





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






Today:
Readings for Today: Data Structures, Chapter 2.
Readings for next Topic: Data Structures, Chapter 3.
11
14
Collection
List Set
SortedSet
LinkedList ArrayList Vector HashSet TreeSet
Map Stack
SortedMap
HashMap WeakHashMap TreeMap
Key: interface
class
: extends : implements
interface Collection { contains, containsAll, size, iterator, ... } interface Expandable { add, addAll } interface Shrinkable { remove, removeAll, difference, ... } interface ModifiableCollection extends Collection, Expandable, Shrinkable { } ... You’d soon have lots of interfaces. Perhaps that’s why they didn’t do it that way.)
New Concept: A view is an alternative presentation of (interface to) an existing object.
︸ ︷︷ ︸
List
package java.util; public interface Map<Key,Value> { Value get (Object key); // Value at KEY. Object put (Key key, Value value); // Set get(KEY) -> VALUE ... }
Map<String,String> f = new TreeMap<String,String> (); f.put ("Paul", "George"); f.put ("George", "Martin"); f.put ("Dana", "John"); // Now f.get ("Paul").equals ("George") // f.get ("Dana").equals ("John") // f.get ("Tom") == null