public void set(final TraversalParent parent, final Object... keyValues) {
        if (keyValues.length % 2 != 0)
            throw Element.Exceptions.providedKeyValuesMustBeAMultipleOfTwo();

        for (int ix = 0; ix < keyValues.length; ix = ix + 2) {
            if (!(keyValues[ix] instanceof String) && !(keyValues[ix] instanceof T) && !(keyValues[ix] instanceof Traversal))
                throw new IllegalArgumentException("The provided key/value array must have a String, T, or Traversal on even array indices");

            // check both key and value for traversal instances. track the list of traversals that are present so
            // that elsewhere in Parameters there is no need to iterate all values to not find any. also grab
            // available labels in traversal values
            for (int iy = 0; iy < 2; iy++) {
                if (keyValues[ix + iy] instanceof Traversal.Admin) {
                    final Traversal.Admin t = (Traversal.Admin) keyValues[ix + iy];
                    addTraversal(t);
                    if (parent != null) parent.integrateChild(t);
                }
            }

            List<Object> values = this.parameters.get(keyValues[ix]);
            if (null == values) {
                values = new ArrayList<>();
                values.add(keyValues[ix + 1]);
                this.parameters.put(keyValues[ix], values);
            } else {
                values.add(keyValues[ix + 1]);
            }
        }
    }
Set parameters given key/value pairs.
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java