/**
  * gets the requested values from the Has step. If it's a single value, wrap it in an array,
  * otherwise return the array
  */
 private Optional<Pair<String, Iterator<Object>>> getValuePair(HasContainer c) {
   Iterator<Object> values;
   if (c.getPredicate().getBiPredicate() == Contains.within)
     values = ((Iterable<Object>) c.getValue()).iterator();
   else values = IteratorUtils.of(c.getValue());
   return Optional.of(new Pair<>(c.getKey(), values));
 }
  private Predicates getPredicates(Step step, Traversal.Admin traversal) {
    Predicates predicates = new Predicates();
    Step<?, ?> nextStep = step.getNextStep();

    while (true) {
      if (nextStep instanceof HasContainerHolder) {
        HasContainerHolder hasContainerHolder = (HasContainerHolder) nextStep;
        boolean skip = false;
        for (HasContainer has : hasContainerHolder.getHasContainers())
          if (has.getPredicate().getTraversals().size() > 0) skip = true;

        if (!skip) {
          hasContainerHolder.getHasContainers().forEach((has) -> predicates.hasContainers.add(has));
          nextStep.getLabels().forEach(label -> predicates.labels.add(label.toString()));
          traversal.removeStep(nextStep);
        }
      } else if (nextStep instanceof RangeGlobalStep) {
        RangeGlobalStep rangeGlobalStep = (RangeGlobalStep) nextStep;
        predicates.limitLow = rangeGlobalStep.getLowRange();
        predicates.limitHigh = rangeGlobalStep.getHighRange();
        traversal.removeStep(nextStep);
      } else return predicates;

      nextStep = nextStep.getNextStep();
    }
  }