Hello I'm beginner when it comes to Java 8 so please be patient for me :)
I have a method that returns custom list of objects. What I need to do: I have got a list of disabledPaymentTypesStrings - and I don't know how many elements it has got. How can I change my code in order to not write every condition like !paymentType.getName().equalsIgnoreCase(disabledPaymentTypesStrings.get(1))? I would like to have somehow my whole list "disabledPaymentTypesStrings" placed here as a condition but I have no idea how to do that. Please give me some hints or advices :)
private List<PaymentType> listOfPaymentTypesForChangePayment(OrderPaymentTypeParameters paymentTypeParameters) { List<String> disabledPaymentTypesStrings = newArrayList(Splitter.on(COMMA).split(systemUtils.getChangePaymentTypeDisabled())); return paymentTypeSelector.availablePaymentTypesForChangePayment(paymentTypeParameters).stream() .filter(paymentType -> !paymentType.getName().equalsIgnoreCase(disabledPaymentTypesStrings.get(0)) && !paymentType.getName().equalsIgnoreCase(disabledPaymentTypesStrings.get(1)) && !paymentType.getName().equalsIgnoreCase(disabledPaymentTypesStrings.get(2))) .collect(toList()); }