update code to java 8