0

I'm trying to use the method references of Java 8. However, Eclipse says I'm using an invalid assignment operator instead of accepting the reference. I do not realize what my mistake is. Thanks!

public static void printAlumnes(Curs curs)
{
    String string = alumnesLlista.values().stream()

    .filter(alumne -> alumne.getCurs().equals(curs))
    .map(Alumne::toString())
    .sorted()
    .collect(Collectors.joining(" ; "));
1
  • 4
    .map(Alumne::toString) Commented Oct 29, 2018 at 8:53

1 Answer 1

5

Alumne::toString() is not valid syntax for a method reference. It should be Alumne::toString (i.e. no parentheses)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.