Add a nearest neighbor solver (WriteAwareBruteSolver) and some basic caching to the Java API adapter. Fix a comment typo with an off-by-one error