Skip to content

Commit

Permalink
Add exec() methods to tuples.
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasMikula committed Jul 2, 2014
1 parent 016c98f commit 12013af
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 0 deletions.
6 changes: 6 additions & 0 deletions reactfx/src/main/java/org/reactfx/util/HexaConsumer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.reactfx.util;

@FunctionalInterface
public interface HexaConsumer<A, B, C, D, E, F> {
void accept(A a, B b, C c, D d, E e, F f);
}
6 changes: 6 additions & 0 deletions reactfx/src/main/java/org/reactfx/util/PentaConsumer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.reactfx.util;

@FunctionalInterface
public interface PentaConsumer<A, B, C, D, E> {
void accept(A a, B b, C c, D d, E e);
}
6 changes: 6 additions & 0 deletions reactfx/src/main/java/org/reactfx/util/TetraConsumer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.reactfx.util;

@FunctionalInterface
public interface TetraConsumer<A, B, C, D> {
void accept(A a, B b, C c, D d);
}
5 changes: 5 additions & 0 deletions reactfx/src/main/java/org/reactfx/util/Tuple2.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.reactfx.util.Tuples.*;

import java.util.Objects;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.BiPredicate;

Expand Down Expand Up @@ -31,6 +32,10 @@ public boolean test(BiPredicate<? super A, ? super B> f) {
return f.test(_1, _2);
}

public void exec(BiConsumer<? super A, ? super B> f) {
f.accept(_1, _2);
}

@Override
public boolean equals(Object other) {
if(other instanceof Tuple2) {
Expand Down
4 changes: 4 additions & 0 deletions reactfx/src/main/java/org/reactfx/util/Tuple3.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public boolean test(TriPredicate<? super A, ? super B, ? super C> f) {
return f.test(_1, _2, _3);
}

public void exec(TriConsumer<? super A, ? super B, ? super C> f) {
f.accept(_1, _2, _3);
}

@Override
public boolean equals(Object other) {
if(other instanceof Tuple3) {
Expand Down
4 changes: 4 additions & 0 deletions reactfx/src/main/java/org/reactfx/util/Tuple4.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ public boolean test(TetraPredicate<? super A, ? super B, ? super C, ? super D> f
return f.test(_1, _2, _3, _4);
}

public void exec(TetraConsumer<? super A, ? super B, ? super C, ? super D> f) {
f.accept(_1, _2, _3, _4);
}

@Override
public boolean equals(Object other) {
if(other instanceof Tuple4) {
Expand Down
4 changes: 4 additions & 0 deletions reactfx/src/main/java/org/reactfx/util/Tuple5.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public boolean test(PentaPredicate<? super A, ? super B, ? super C, ? super D, ?
return f.test(_1, _2, _3, _4, _5);
}

public void exec(PentaConsumer<? super A, ? super B, ? super C, ? super D, ? super E> f) {
f.accept(_1, _2, _3, _4, _5);
}

@Override
public boolean equals(Object other) {
if(other instanceof Tuple5) {
Expand Down
4 changes: 4 additions & 0 deletions reactfx/src/main/java/org/reactfx/util/Tuple6.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ public boolean test(HexaPredicate<? super A, ? super B, ? super C, ? super D, ?
return f.test(_1, _2, _3, _4, _5, _6);
}

public void exec(HexaConsumer<? super A, ? super B, ? super C, ? super D, ? super E, ? super F> f) {
f.accept(_1, _2, _3, _4, _5, _6);
}

@Override
public boolean equals(Object other) {
if(other instanceof Tuple6) {
Expand Down

0 comments on commit 12013af

Please sign in to comment.