New method on java.util.function.Function -- ternary method

2023-10-03 Thread David Alayachew
Hello all, I have an idea that I want to run by you all -- a new method on java.util.function.Function to capture ternary operations. Here is a mockup of what I wanted to do. > > import java.util.function.Function; > > @FunctionalInterface > public interface Function2 extends Function > { > >

Re: New method on java.util.function.Function -- ternary method

2023-10-03 Thread David Alayachew
Whoops, bad import. Please replace the following line with the one after it. > import java.util.function.Function; > import java.util.function.*; On Tue, Oct 3, 2023 at 3:09 AM David Alayachew wrote: > Hello all, > > I have an idea that I want to run by you all -- a new method on > java.util.

Re: New method on java.util.function.Function -- ternary method

2023-11-08 Thread David Alayachew
It has been a month since I sent this proposal. Since no one has told me that this is a terrible idea, I will submit this as an enhancement to JBS, and once the ticket is made, start work on creating a pull request. On Tue, Oct 3, 2023 at 3:13 AM David Alayachew wrote: > Whoops, bad import. > >

Re: New method on java.util.function.Function -- ternary method

2023-11-08 Thread David Alayachew
Oh, I will also add a specialized version of this method to java.util.function.UnaryOperator. That is because UnaryOperator is a subinterface of Function. Function goes T -> R, but UnaryOperator just goes T -> T. We do not want UnaryOperator to have the T -> R static function included due to inheri

Re: New method on java.util.function.Function -- ternary method

2023-12-31 Thread David Alayachew
Hello all, After reading through Brian Goetz's "Effect cases on Switch" (specifically, the "Other switch tricks" section), I have decided to not implement this feature after all. The fact is, switch expressions, especially with "when-clauses", does a better job of clarifying intent than this featu

Re: New method on java.util.function.Function -- ternary method

2024-01-15 Thread David Alayachew
Hello Magnus, Thank you for closing my bug! Terribly sorry to ask another favor, but could you link the following link for traceability in the JBS submission? https://mail.openjdk.org/pipermail/amber-dev/2024-January/008488.html Thank you again for the time and help! David Alayachew On Mon, Jan