@Test public void putUnique() throws BadDataException { final Map<String,String> map = new HashMap<String,String>(); final String key = "Bernadotte"; final String val = "marshal of France"; Record.put(key, val, map); assertEquals(1, map.size()); assertEquals(val, map.get(key)); }
public static <K,V> void put(K key, V value, Map<K,V> map) throws BadDataException { final V old = map.put(key, value); if (old != null) { throw new BadDataException("duplicate key: " + key); } }
Record { public static <K,V> void put(K key, V value, Map<K,V> map) throws BadDataException { final V old = map.put(key, value); if (old != null) { throw new BadDataException("duplicate key: " + key); } } }
Record { public static <K,V> void put(K key, V value, Map<K,V> map) throws BadDataException { final V old = map.put(key, value); if (old != null) { throw new BadDataException("duplicate key: " + key); } } protected  Record(); }
Record { public static <K,V> void put(K key, V value, Map<K,V> map) throws BadDataException { final V old = map.put(key, value); if (old != null) { throw new BadDataException("duplicate key: " + key); } } protected  Record(); static void put(K key, V value, Map<K,V> map); }
Record { public static <K,V> void put(K key, V value, Map<K,V> map) throws BadDataException { final V old = map.put(key, value); if (old != null) { throw new BadDataException("duplicate key: " + key); } } protected  Record(); static void put(K key, V value, Map<K,V> map);  }