Hi I am a c# developer getting into Java. The question is simple:
How can i write the below c# code into Java and still get it to work:
myCoffeeList.OrderByDescending(x => x.Name?.ToLower()?.Trim() == sender.Text.ToLower()?.Trim()));
My sender.Text
is basically a textbox.Text with a value like Cappuccino
.
What does the above code do?
Well I have a collection of coffee and I want that the name of the coffee that exactly matches the sender.text should be on top and the rest can be of the order returned from the server.
I've checked out the below:
list.streams to use something like a LINQ
Anotation type OrderBy but it's related to databases