/** * Performs the given action for each key-value pair in this data structure * until all entries have been processed or the action throws an exception. * <p> * Some implementations may not support structural modifications (adding new elements or removing elements) while * iterating over the contents. In such implementations, attempts to add or remove elements from the * {@code BiConsumer}'s {@link BiConsumer#accept(Object, Object)} accept} method may cause a * {@code ConcurrentModificationException} to be thrown. * </p> * * @param action The action to be performed for each key-value pair in this collection * @param <CV> type of the consumer value * @throws java.util.ConcurrentModificationException some implementations may not support structural modifications * to this data structure while iterating over the contents with {@link #forEach(BiConsumer)} or * {@link #forEach(TriConsumer, Object)}. * @see ReadOnlyStringMap#forEach(BiConsumer) * @since 2.9 */ public <CV> void forEach(final BiConsumer<String, ? super CV> action) { data.forEach(action); }
/** * Performs the given action for each key-value pair in this data structure * until all entries have been processed or the action throws an exception. * <p> * The third parameter lets callers pass in a stateful object to be modified with the key-value pairs, * so the TriConsumer implementation itself can be stateless and potentially reusable. * </p> * <p> * Some implementations may not support structural modifications (adding new elements or removing elements) while * iterating over the contents. In such implementations, attempts to add or remove elements from the * {@code TriConsumer}'s {@link TriConsumer#accept(Object, Object, Object) accept} method may cause a * {@code ConcurrentModificationException} to be thrown. * </p> * * @param action The action to be performed for each key-value pair in this collection * @param state the object to be passed as the third parameter to each invocation on the specified * triconsumer * @param <CV> type of the consumer value * @param <S> type of the third parameter * @throws java.util.ConcurrentModificationException some implementations may not support structural modifications * to this data structure while iterating over the contents with {@link #forEach(BiConsumer)} or * {@link #forEach(TriConsumer, Object)}. * @see ReadOnlyStringMap#forEach(TriConsumer, Object) * @since 2.9 */ public <CV, S> void forEach(final TriConsumer<String, ? super CV, S> action, final S state) { data.forEach(action, state); }
/** * Performs the given action for each key-value pair in this data structure * until all entries have been processed or the action throws an exception. * <p> * Some implementations may not support structural modifications (adding new elements or removing elements) while * iterating over the contents. In such implementations, attempts to add or remove elements from the * {@code BiConsumer}'s {@link BiConsumer#accept(Object, Object)} accept} method may cause a * {@code ConcurrentModificationException} to be thrown. * </p> * * @param action The action to be performed for each key-value pair in this collection * @param <CV> type of the consumer value * @throws java.util.ConcurrentModificationException some implementations may not support structural modifications * to this data structure while iterating over the contents with {@link #forEach(BiConsumer)} or * {@link #forEach(TriConsumer, Object)}. * @see ReadOnlyStringMap#forEach(BiConsumer) * @since 2.9 */ public <CV> void forEach(final BiConsumer<String, ? super CV> action) { data.forEach(action); }
/** * Performs the given action for each key-value pair in this data structure * until all entries have been processed or the action throws an exception. * <p> * The third parameter lets callers pass in a stateful object to be modified with the key-value pairs, * so the TriConsumer implementation itself can be stateless and potentially reusable. * </p> * <p> * Some implementations may not support structural modifications (adding new elements or removing elements) while * iterating over the contents. In such implementations, attempts to add or remove elements from the * {@code TriConsumer}'s {@link TriConsumer#accept(Object, Object, Object) accept} method may cause a * {@code ConcurrentModificationException} to be thrown. * </p> * * @param action The action to be performed for each key-value pair in this collection * @param state the object to be passed as the third parameter to each invocation on the specified * triconsumer * @param <CV> type of the consumer value * @param <S> type of the third parameter * @throws java.util.ConcurrentModificationException some implementations may not support structural modifications * to this data structure while iterating over the contents with {@link #forEach(BiConsumer)} or * {@link #forEach(TriConsumer, Object)}. * @see ReadOnlyStringMap#forEach(TriConsumer, Object) * @since 2.9 */ public <CV, S> void forEach(final TriConsumer<String, ? super CV, S> action, final S state) { data.forEach(action, state); }
/** @deprecated use {@link #getStringMap()} instead */ @Deprecated protected Map<String, List<String>> getMap() { final Map<String, List<String>> result = new HashMap<>(map.size()); map.forEach(new BiConsumer<String, List<String>>() { @Override public void accept(final String key, final List<String> value) { result.put(key, value); } }); return result; }