How exactly do you chain method references for instances with Java 8? Example:
Collections.sort(civs,Comparator.comparing(Civilization::getStrategy.getStrategLevel));
getStrategy of a Civilization instance returns a Strategy object instance which has the instance method getStrategyLevel.
Why doesn't the Comparator.comparing method return a comparator with it's functional interface implemented by the lambda expression?
getStrategy(), then callgetStrategyLevel()on the result) is not a method, therefore it is not suitable for describing with a method reference. If you want to describe an arbitrary bag of imperative code, use a lambda; method refs are a (hopefully more readable) shorthand provided for the special case where the lambda body is a single method whose argument list matches exactly that of the target functional interface.