How can I convert the following pseudo code into a Java 8 lambda?:
...
if(fee.getTaxID() not in (126,127,128))
{
...
I'm hoping that by leveraging lambdas I can avoid the following code:
...
if(fee.getTaxID() != 126 && fee.getTaxID() != 127 && fee.getTaxID() != 128))
{
...
The goal is that I can replace the 126,127,128 in the pseudo code with a List<Integer>
Thanks
If you really want to do it using lambda, you can do this:
if(IntStream.of(126,127,128).noneMatch(t -> t == fee.getTaxID())) {
}
It does not make the code shorter though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With