Path extends ArrayList<K> { @SuppressWarnings("unchecked") public Path<K> to(K subKey) { return via(subKey); } Path();  Path(List<K> keys);  Path(K... keys); @SuppressWarnings("unchecked") Path<K> to(K subKey); Path<K> via(K... subKeys); @Override String toString();  }
@Test public void testTo() throws Exception { Path<Integer> p = new Path<Integer>(); assertEquals(p.to(1).toString(), "1"); assertEquals(p.to(1).to(2).to(3).size(), 3); assertEquals(p.to(1).to(2).to(3).toString(), "1/2/3"); }