When.java - ported map() functionality