Java: sorting an array with lambda expression?
问题 I've recently got into functional programming and Java 8 lambdas. I have an array of ints and I want to sort it in an ascending order. The way I am trying to do this with lambda is as follows: Arrays.stream(intArray).sorted((x, y) -> Integer.compare(x, y) == -1); The issue with this is that my compiler says: Error:(12, 32) java: method sorted in interface java.util.stream.IntStream cannot be applied to given types; required: no arguments found: (x,y)->Int[...]== -1 reason: actual and formal