package bjc.utils.data; import java.util.function.BiConsumer; import java.util.function.BiFunction; import java.util.function.Function; public interface IPair { /** * Create a new pair by applying the given functions to the left/right. * Does not change the internal contents of this pair. * * @param lf * The function to apply to the left value. * @param rf * The function to apply to the right value. * @return A new pair containing the two modified values. */ public IPair apply(Function lf, Function rf); /** * Collapse this pair to a single value. Does not change the internal * contents of this pair. * * @param bf * The function to use to collapse the pair. * @return The collapsed value. */ public E merge(BiFunction bf); /** * Execute an action with the values of this pair. Has no effect on the * internal contents * * @param bc * The action to execute on the values */ public void doWith(BiConsumer bc); }