com.jnape.palatable.lambda.functions.builtin.fn2.Into5 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lambda Show documentation
Show all versions of lambda Show documentation
Functional patterns for Java
package com.jnape.palatable.lambda.functions.builtin.fn2;
import com.jnape.palatable.lambda.adt.product.Product5;
import com.jnape.palatable.lambda.functions.Fn1;
import com.jnape.palatable.lambda.functions.Fn2;
import com.jnape.palatable.lambda.functions.Fn5;
/**
* Given an {@link Fn5}<A, B, C, D, E, F>
and a {@link Product5}<A, B, C, D, E>
,
* destructure the product and apply the slots as arguments to the function, returning the result.
*
* @param the first argument type
* @param the second argument type
* @param the third argument type
* @param the fourth argument type
* @param the fifth argument type
* @param the result type
*/
public final class Into5 implements Fn2, Product5, F> {
private static final Into5, ?, ?, ?, ?, ?> INSTANCE = new Into5<>();
@Override
public F checkedApply(Fn5 super A, ? super B, ? super C, ? super D, ? super E, ? extends F> fn,
Product5 product) {
return product.into(fn);
}
@SuppressWarnings("unchecked")
public static Into5 into5() {
return (Into5) INSTANCE;
}
public static Fn1, F> into5(
Fn5 super A, ? super B, ? super C, ? super D, ? super E, ? extends F> fn) {
return Into5.into5().apply(fn);
}
public static F into5(Fn5 super A, ? super B, ? super C, ? super D, ? super E, ? extends F> fn,
Product5 product) {
return Into5.into5(fn).apply(product);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy