rewrite java 8