defaultvoidforEach(BiConsumer<? super K, ? super V> action) { Objects.requireNonNull(action); for (Map.Entry<K, V> entry : entrySet()) { K k; V v; try { k = entry.getKey(); v = entry.getValue(); } catch(IllegalStateException ise) { // this usually means the entry is no longer in the map. thrownewConcurrentModificationException(ise); } action.accept(k, v); } }
@FunctionalInterface publicinterfaceBiConsumer<T, U> { voidaccept(T t, U u);
default BiConsumer<T, U> andThen(BiConsumer<? super T, ? super U> after) { Objects.requireNonNull(after);