Skip to content

Instantly share code, notes, and snippets.

@Koboo
Created June 11, 2021 07:24
Show Gist options
  • Save Koboo/6f9bf1087298eef6548e978eb83961f8 to your computer and use it in GitHub Desktop.
Save Koboo/6f9bf1087298eef6548e978eb83961f8 to your computer and use it in GitHub Desktop.
Java Consumer imitation with up to 5 parameters
public interface Handle {
interface Two<T1, T2> {
void handle(T1 item1, T2 item2);
}
interface Three<T1, T2, T3> {
void handle(T1 item1, T2 item2, T3 item3);
}
interface Four<T1, T2, T3, T4> {
void handle(T1 item1, T2 item2, T3 item3, T4 item4);
}
interface Five<T1, T2, T3, T4, T5> {
void handle(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment