refine example for java 8