Java 8 solution is cleaner.