SortedMapWritable extends AbstractMapWritable implements SortedMap<K, Writable> { @Override public Writable put(K key, Writable value) { addToMap(key.getClass()); addToMap(value.getClass()); return instance.put(key, value); } SortedMapWritable();  SortedMapWritable(SortedMapWritable<K> other); @Override Comparator<? super K> comparator(); @Override K firstKey(); @Override SortedMap<K, Writable> headMap(K toKey); @Override K lastKey(); @Override SortedMap<K, Writable> subMap(K fromKey, K toKey); @Override SortedMap<K, Writable> tailMap(K fromKey); @Override void clear(); @Override boolean containsKey(Object key); @Override boolean containsValue(Object value); @Override Set<Map.Entry<K, Writable>> entrySet(); @Override Writable get(Object key); @Override boolean isEmpty(); @Override Set<K> keySet(); @Override Writable put(K key, Writable value); @Override void putAll(Map<? extends K, ? extends Writable> t); @Override Writable remove(Object key); @Override int size(); @Override Collection<Writable> values(); @SuppressWarnings("unchecked") @Override void readFields(DataInput in); @Override void write(DataOutput out); @Override boolean equals(Object obj); @Override int hashCode();  }
@Test @SuppressWarnings("deprecation") public void testForeignClass() { SortedMapWritable<Text> inMap = new SortedMapWritable<Text>(); inMap.put(new Text("key"), new UTF8("value")); inMap.put(new Text("key2"), new UTF8("value2")); SortedMapWritable<Text> outMap = new SortedMapWritable<Text>(inMap); SortedMapWritable<Text> copyOfCopy = new SortedMapWritable<Text>(outMap); assertEquals(1, copyOfCopy.getNewClasses()); }