public boolean matches(final Object o) {
        // introduce some custom handling for Path since we don't really want to assert the labels
        if (o instanceof Path) {
            return this.collection.stream().anyMatch(c -> new IsPathEqualToMatcher((Path) o).matchesSafely((Path) c));
        } else {
            return this.collection.contains(o);
        }
    }
Customer matcher than mimics the behavior of the Hamcrest {@code IsIn} but handles {@link Path} using our custom
{@link IsPathEqualToMatcher} to ignore labels.
gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/features/IsInMatcher.java