Using Java 7 Comparators in Java 8

∥☆過路亽.° 提交于 2019-12-03 23:01:32

The new methods in the Java 8 version of Comparator are default methods (a new feature in Java 8) which not only include the method signature, but also a default implementation. Thus, older Comparator implementations should work just fine on Java 8 if they worked before.

If something is not working, please let us know what you are trying and what the error message is.

I had a similar problem like thobens: Updated my Kepler 4.2.3 to use Java 8, set JAVA 8 as new JRE, etc. Like thobens I got an error on Comparators by eclipse requesting me to implement all unimplemented methods.

Finally this was caused by the old Compiler compilance level (1.7) - switching to 1.8 solved this trouble.

that happen because for java 7 Comparator does not had all the other methods, when you update Eclipse to Java 1.8 then the new methods are needed in order to use Comparator, to solve this just in change the Compiler back to Java 1.7 ( properties - Java Compiler --- JDK Compliance ), refresh your project an that it.. hope this help

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!