Skip to content

Commit

Permalink
Added the TriFunction functional interface
Browse files Browse the repository at this point in the history
  • Loading branch information
lyubomyr-shaydariv committed Sep 25, 2024
1 parent 52e9956 commit fe045ce
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/main/java/lsh/ext/gson/IBuilder3.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@ public interface IBuilder3<A1, A2, A3, R> {

R build();

static <A1, A2, A3, R> IBuilder3<A1, A2, A3, R> of(
final TriConsumer<? super A1, ? super A2, ? super A3> consume,
final Supplier<? extends R> build
) {
return new IBuilder3<>() {
@Override
public void accept(final A1 a1, final A2 a2, final A3 a3) {
consume.accept(a1, a2, a3);
}

@Override
public R build() {
return build.get();
}
};
}

interface ILookup<A1, A2, A3, R> {

Supplier<IBuilder3<A1, A2, A3, R>> lookup(TypeToken<? super R> typeToken);
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/lsh/ext/gson/TriConsumer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package lsh.ext.gson;

@FunctionalInterface
public interface TriConsumer<T, U, V> {

void accept(T t, U u, V v);

}

0 comments on commit fe045ce

Please sign in to comment.