public final boolean test(final Element element) {
        // it is OK to evaluate equality of ids via toString(), given that the test suite enforces the value of
        // id().toString() to be a first class representation of the identifier. a string test is only executed
        // if the predicate value is a String.  this allows stuff like: g.V().has(id,lt(10)) to work properly
        if (this.key != null) {
            if (this.key.equals(T.id.getAccessor()))
                return testingIdString ? testIdAsString(element) : testId(element);
            if (this.key.equals(T.label.getAccessor()))
                return testLabel(element);
        }

        final Iterator<? extends Property> itty = element.properties(this.key);
        try {
            while (itty.hasNext()) {
                if (testValue(itty.next()))
                    return true;
            }
        } finally {
            CloseableIterator.closeIterator(itty);
        }
        return false;
    }
@author Marko A. Rodriguez (http://markorodriguez.com)
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/HasContainer.java