LOG4J2-1447 BiConsumer and TriConsumer define interfaces for iterating over the 
key-value pairs in a ContextData collection without allocating temporary objects


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/411c210a
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/411c210a
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/411c210a

Branch: 
refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Commit: 411c210a908e7329ef2aab29ba48b5df71a63b5e
Parents: 5ecc7f4
Author: rpopma <[email protected]>
Authored: Wed Jul 27 00:19:25 2016 +0900
Committer: rpopma <[email protected]>
Committed: Wed Jul 27 00:19:25 2016 +0900

----------------------------------------------------------------------
 .../logging/log4j/core/util/BiConsumer.java     | 19 ++++++++++++++++++
 .../logging/log4j/core/util/TriConsumer.java    | 21 ++++++++++++++++++++
 2 files changed, 40 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/411c210a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/BiConsumer.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/BiConsumer.java 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/BiConsumer.java
new file mode 100644
index 0000000..081b9c2
--- /dev/null
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/BiConsumer.java
@@ -0,0 +1,19 @@
+package org.apache.logging.log4j.core.util;
+
+/**
+ * An operation that accepts two input arguments and returns no result.
+ *
+ * @param <K> type of the first argument
+ * @param <V> type of the second argument
+ * @see org.apache.logging.log4j.core.ContextData
+ * @since 2.7
+ */
+public interface BiConsumer<K, V> {
+
+    /**
+     * Performs the operation given the specified arguments.
+     * @param k the first input argument
+     * @param v the second input argument
+     */
+    void accept(K k, V v);
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/411c210a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/TriConsumer.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/TriConsumer.java 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/TriConsumer.java
new file mode 100644
index 0000000..a7d6213
--- /dev/null
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/TriConsumer.java
@@ -0,0 +1,21 @@
+package org.apache.logging.log4j.core.util;
+
+/**
+ * An operation that accepts three input arguments and returns no result.
+ *
+ * @param <K> type of the first argument
+ * @param <V> type of the second argument
+ * @param <S> type of the third argument
+ * @see org.apache.logging.log4j.core.ContextData
+ * @since 2.7
+ */
+public interface TriConsumer<K, V, S> {
+
+    /**
+     * Performs the operation given the specified arguments.
+     * @param k the first input argument
+     * @param v the second input argument
+     * @param s the third input argument
+     */
+    void accept(K k, V v, S s);
+}

Reply via email to