Remove usage of a java 8 method