Updated code to reflect semantic changes in java 8