Code Handout to accompany final exam CSCI 455 F14 Bono C Node type and ListType this is the only part of the code handout with C code struct Node int data Node next Node data 0 next NULL Node int d data d next NULL Node int d Node n data d next n typedef Node ListType Java Map KeyType ValueType Interface The classes that implement this interface are TreeMap and HashMap Selected methods ValueType put key value Associates the specified value with the specified key in this map If the map previously contained a mapping for this key the old value is replaced by the specified value Returns the previous value associated with specified key or null if there was no mapping for key ValueType get key Returns the value to which this key is mapped or null if the map contains no mapping for this key ValueType remove key Removes the mapping for this key from this map if it is present otherwise returns null int size Number of key value mappings in this map boolean isEmpty Returns true if this map contains no key value mappings Set Map Entry KeyType ValueType entrySet Returns a set view of the entries contained in this map Set KeyType keySet Returns a set view of the keys contained in this map Java Map Entry KeyType ValueType Interface Selected methods KeyType getKey Return the key of the entry ValueType getValue Return the value of the entry void setValue newVal Replace the current value with newVal Java Set ElmtType Interface Selected methods Iterator ElmtType iterator Returns an iterator over the elements in this collection Java Iterator ElmtType Interface boolean hasNext Returns true iff the iteration has more elements ElmtType next Returns the next element in the iteration Each successive call returns a different element in the underlying collection void remove Removes from the underlying collection the last element returned by the iterator
View Full Document