renamed apply to indexApply as it causes compilation error, possibly a jdk8 bug