I don't know all capabilities of Stream API.
I have an AutoCompleteTextView with custom adaptor,I made a method that know if entered data in AutoCompleteTextView is from suggested data or not ,

Now I want rewrite it using Lightweight-Stream-API for using under api 24
method in java8
private boolean isFromSuggestedData(List<StoreCategory> list, final String nameEnglish){
return list.stream().anyMatch(item -> nameEnglish.equals(item.getNameEnglish()));
}
You can use kotlin "any" function
private fun isFormSuggestedData(list: List<StoreCategory>, nameEnglish: String): Boolean = list.any { nameEnglish == it.nameEnglish }
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