StringToIntMapper { public synchronized void reset(S subset) { if (subset == null) { throw new IllegalArgumentException("subset is null"); } id2num.put(subset, HashBiMap.<String, Integer>create()); counter.put(subset, subset.getInitialValue()); } StringToIntMapper(Class<S> clazz); synchronized int newInt(S subset, String id); synchronized int getInt(S subset, String id); synchronized String getId(S subset, int num); synchronized boolean isMapped(S subset, String id); synchronized boolean isModified(); synchronized void dump(Writer writer); void dump(Path file); synchronized void load(BufferedReader reader); void load(Path file); synchronized void reset(S subset);  }
@Test public void test() throws IOException { StringToIntMapper<TestSubset> mapper = new StringToIntMapper<>(TestSubset.class); testAddMapping(mapper); mapper.reset(TestSubset.TYPE); testAddMapping(mapper); try { mapper.reset(null); fail(); } catch (IllegalArgumentException ignored) { } }