fix Java 8 examples that use old API