UnionMap extends AbstractMap<K, V> { @Override public boolean isEmpty() { return first.isEmpty() && second.isEmpty(); } UnionMap(Map<K, V> first, Map<K, V> second); @Override int size(); @Override boolean isEmpty(); @Override boolean containsKey(Object key); @Override boolean containsValue(Object value); @Override V get(Object key); @Override V put(K key, V value); @Override V remove(Object key); @Override void clear(); @Override Set<Entry<K, V>> entrySet();  }
@Test void testIsEmpty() { assertThat(new UnionMap<String, String>(of(), of())).isEmpty(); assertThat(new UnionMap<>(of(), of("1", "a"))).isNotEmpty(); assertThat(new UnionMap<>(of("1", "a"), of())).isNotEmpty(); }