@Test public void testPut() throws Exception { highlightDataMap.put("new_key", highlightData2); assertThat(highlightDataMap.containsKey("new_key"), is(true)); assertThat(highlightDataMap.get("new_key"), is(highlightData2)); }
@Override public HighlightData put(String key, HighlightData data) { if (key == null) { throw new IllegalArgumentException(String.format("Cannot put '%s' data when the key is null!", data)); } if (data == null) { throw new IllegalArgumentException("Cannot put null data!"); } if (map.containsKey(key)) { final List<String> values = new ArrayList<>(map.get(key).getValues()); values.addAll(data.getValues()); return map.put(key, new HighlightData(key, values, data.getLevel(), data.getBlock(), data.getOrder())); } return map.put(key, data); }
HighlightDataMap implements Map<String, HighlightData> { @Override public HighlightData put(String key, HighlightData data) { if (key == null) { throw new IllegalArgumentException(String.format("Cannot put '%s' data when the key is null!", data)); } if (data == null) { throw new IllegalArgumentException("Cannot put null data!"); } if (map.containsKey(key)) { final List<String> values = new ArrayList<>(map.get(key).getValues()); values.addAll(data.getValues()); return map.put(key, new HighlightData(key, values, data.getLevel(), data.getBlock(), data.getOrder())); } return map.put(key, data); } }
HighlightDataMap implements Map<String, HighlightData> { @Override public HighlightData put(String key, HighlightData data) { if (key == null) { throw new IllegalArgumentException(String.format("Cannot put '%s' data when the key is null!", data)); } if (data == null) { throw new IllegalArgumentException("Cannot put null data!"); } if (map.containsKey(key)) { final List<String> values = new ArrayList<>(map.get(key).getValues()); values.addAll(data.getValues()); return map.put(key, new HighlightData(key, values, data.getLevel(), data.getBlock(), data.getOrder())); } return map.put(key, data); } HighlightDataMap();  HighlightDataMap(int initialCapacity); }
HighlightDataMap implements Map<String, HighlightData> { @Override public HighlightData put(String key, HighlightData data) { if (key == null) { throw new IllegalArgumentException(String.format("Cannot put '%s' data when the key is null!", data)); } if (data == null) { throw new IllegalArgumentException("Cannot put null data!"); } if (map.containsKey(key)) { final List<String> values = new ArrayList<>(map.get(key).getValues()); values.addAll(data.getValues()); return map.put(key, new HighlightData(key, values, data.getLevel(), data.getBlock(), data.getOrder())); } return map.put(key, data); } HighlightDataMap();  HighlightDataMap(int initialCapacity); @Override int size(); @Override boolean isEmpty(); @Override boolean containsKey(Object key); @Override boolean containsValue(Object value); @Override HighlightData get(Object key); @Override HighlightData put(String key, HighlightData data); @Override HighlightData remove(Object key); @Override void putAll(Map<? extends String, ? extends HighlightData> m); @Override void clear(); @NotNull @Override Set<String> keySet(); @NotNull @Override Collection<HighlightData> values(); @NotNull @Override Set<Entry<String, HighlightData>> entrySet(); }
HighlightDataMap implements Map<String, HighlightData> { @Override public HighlightData put(String key, HighlightData data) { if (key == null) { throw new IllegalArgumentException(String.format("Cannot put '%s' data when the key is null!", data)); } if (data == null) { throw new IllegalArgumentException("Cannot put null data!"); } if (map.containsKey(key)) { final List<String> values = new ArrayList<>(map.get(key).getValues()); values.addAll(data.getValues()); return map.put(key, new HighlightData(key, values, data.getLevel(), data.getBlock(), data.getOrder())); } return map.put(key, data); } HighlightDataMap();  HighlightDataMap(int initialCapacity); @Override int size(); @Override boolean isEmpty(); @Override boolean containsKey(Object key); @Override boolean containsValue(Object value); @Override HighlightData get(Object key); @Override HighlightData put(String key, HighlightData data); @Override HighlightData remove(Object key); @Override void putAll(Map<? extends String, ? extends HighlightData> m); @Override void clear(); @NotNull @Override Set<String> keySet(); @NotNull @Override Collection<HighlightData> values(); @NotNull @Override Set<Entry<String, HighlightData>> entrySet();  }