I can't see your code, or the error you are getting. So this is a guess.
I believe you want
class Test {
// I assume that Client looks like this.
static class Client {
public String name;
}
// And that Sell looks like this.
// I'm sure your Client and Sell are bigger, but this is all
// that matters for now.
static class Sell {
public Client getClient() { return null; }
}
public static void main (String[] args) throws java.lang.Exception
{
List<Sell> sells = new ArrayList<>();
sells.stream().sorted(Comparator.comparing(x -> x.getClient().name, String::compareToIgnoreCase))
}
}
You want to call a method on the return of that, so you need to create an anonymous function.
Your other option would be:
static class Sell {
public String getClientName() { return null; }
}
// ...
sells.stream().sorted(Comparator.comparing(Sell::getClientName, String::compareToIgnoreCase))
ComparatoruseString.CASE_INSENSITIVE_ORDER.String::compareToIgnoreCaseis a comparison method returning an int not aComparator