@Test public void testPrefixSuccessor() { assertPrefixSuccessorEquals("\u0001\u0002", path()); assertPrefixSuccessorEquals("foo" + SEP + "bar\u0001\u0002", path("foo", "bar")); }
static String prefixSuccessor(String path) { StringBuilder result = new StringBuilder(path); int pos = result.length() - 1; char c = result.charAt(pos); hardAssert(c == ENCODED_SEPARATOR, "successor may only operate on paths generated by encode"); result.setCharAt(pos, (char) ((int) c + 1)); return result.toString(); }
EncodedPath { static String prefixSuccessor(String path) { StringBuilder result = new StringBuilder(path); int pos = result.length() - 1; char c = result.charAt(pos); hardAssert(c == ENCODED_SEPARATOR, "successor may only operate on paths generated by encode"); result.setCharAt(pos, (char) ((int) c + 1)); return result.toString(); } }
EncodedPath { static String prefixSuccessor(String path) { StringBuilder result = new StringBuilder(path); int pos = result.length() - 1; char c = result.charAt(pos); hardAssert(c == ENCODED_SEPARATOR, "successor may only operate on paths generated by encode"); result.setCharAt(pos, (char) ((int) c + 1)); return result.toString(); }  }
EncodedPath { static String prefixSuccessor(String path) { StringBuilder result = new StringBuilder(path); int pos = result.length() - 1; char c = result.charAt(pos); hardAssert(c == ENCODED_SEPARATOR, "successor may only operate on paths generated by encode"); result.setCharAt(pos, (char) ((int) c + 1)); return result.toString(); }   }
EncodedPath { static String prefixSuccessor(String path) { StringBuilder result = new StringBuilder(path); int pos = result.length() - 1; char c = result.charAt(pos); hardAssert(c == ENCODED_SEPARATOR, "successor may only operate on paths generated by encode"); result.setCharAt(pos, (char) ((int) c + 1)); return result.toString(); }    }