IdPath { public boolean rootEquals(int id) { return myParts[0] == id; } IdPath(int... parts);  IdPath(Stream s); void write(Stream s); int getId(); IdPath getParent(); IdPath appendedWith(int id); boolean isChildOrParentOf(IdPath p); boolean contains(int id); boolean startsWith(IdPath p); boolean rootEquals(int id); IdPath withoutRoot(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testRootEquals() { assertTrue(new IdPath(1, 2, 3).rootEquals(1)); assertTrue(new IdPath(1).rootEquals(1)); assertFalse(new IdPath(1, 2, 3).rootEquals(2)); }