Amazon Interview Question
Software Engineer / Developerspublic class Entry<K, V> {
private Entry<K, V> next;
private final K key;
private V value;
public Entry(K key, V value) {
this.key = key;
this.setValue(value);
}
public K getKey() {
return key;
}
public void setValue(V value) {
this.value = value;
}
public V getValue() {
return value;
}
public void setNext(Entry<K, V> next) {
this.next = next;
}
public Entry<K, V> getNext() {
return next;
}
}
java collection framework provides a way to implement custom collection class with the help of templates. In case of HashMap we have AbstractHashMap (hope i remember the name correctly.)
- master January 03, 2010