Skip to content

Instantly share code, notes, and snippets.

View richardjwild's full-sized avatar

Richard Wild richardjwild

View GitHub Profile
@richardjwild
richardjwild / java-shell-script
Last active March 27, 2024 13:17
An example of a Java program that can be executed as a shell script.
#!/usr/bin/java --source 17
public class EchoArguments {
public static void main(String[] args) {
System.out.printf("Arguments: %s%n", String.join(", ", args));
}
}
import java.util.function.BiFunction;
import java.util.function.Function;
public class Partial {
static <T, U, V> Function<U, V> applyLeft(BiFunction<T, U, V> dyad, T fixedValue) {
return (U param) -> dyad.apply(fixedValue, param);
}
static <T, U, V> Function<T, V> applyRight(BiFunction<T, U, V> dyad, U fixedValue) {