<p>
Creates an array with the specified elements and an <i>operation expression</i> on it.
</p>

@param elements the elements of the array being created
@return an operator, ready for chaining
763726
public static <T> Level0ArrayOperator<Integer[],Integer> onArrayFor(final Integer... elements) {
        return onArrayOf(Types.INTEGER, VarArgsUtil.asRequiredObjectArray(elements));
    }
14909
public static <T> Level0ArrayOperator<BigInteger[],BigInteger> onArrayFor(final BigInteger... elements) {
        return onArrayOf(Types.BIG_INTEGER, VarArgsUtil.asRequiredObjectArray(elements));
    }
1342407
public static <E> HashSet<E> newHashSet(Iterator<? extends E> elements) {
		HashSet<E> set = newHashSet();
		while (elements.hasNext()) {
			set.add(elements.next());
		}
		return set;
	}
628060
public <T> T randomElement(List<T> elements) {
		return elements.get(randomBetween(0, elements.size() - 1));
	}
330558
@Pure
	public static Map<ShapeElementType, MapElementGroup> classifiesElements(Collection<? extends MapElement> elements) {
		return classifiesElements(elements.iterator());
	}
1277611
public static <T> ArrayList<T> newArrayList(Iterator<? extends T> elements) {
        return Lists.newArrayList(elements);
    }
1181678
public static <T> CollectionExpression<Collection<T>, T> collectionOperation(Class<T> elementType, Operator operator,
                                                                  Expression<?>... args) {
        return new CollectionOperation<T>(elementType, operator, args);
    }
666129
protected final List<String> parseElementList(final List<Element> elements) {
        final List<String> values = new ArrayList<String>();
        for (final Element element : elements) {
            values.add(element.getText());
        }
        return values;
    }
869183
public static Expression asList(Iterable<? extends Expression> items) {
    final ImmutableList<Expression> copy = ImmutableList.copyOf(items);
    if (copy.isEmpty()) {
      return MethodRef.IMMUTABLE_LIST_OF.get(0).invoke();
    }
    // Note, we cannot necessarily use ImmutableList for anything besides the empty list because
    // we may need to put a null in it.
    final Expression construct = ConstructorRef.ARRAY_LIST_SIZE.construct(constant(copy.size()));
    return new Expression(ARRAY_LIST_TYPE, Feature.NON_NULLABLE) {
      @Override
      protected void doGen(CodeBuilder mv) {
        construct.gen(mv);
        for (Expression child : copy) {
          mv.dup();
          child.gen(mv);
          MethodRef.ARRAY_LIST_ADD.invokeUnchecked(mv);
          mv.pop(); // pop the bool result of arraylist.add
        }
      }
    };
  }
708753
public static <E> List<E> copyOf(Iterable<? extends E> elements) {
    Preconditions.checkNotNull(elements, "elements");
    List<E> result = (elements instanceof Collection)
        // can pre-allocate the array
        ? new ArrayList<>(cast(elements).size())
        // cannot
        : new ArrayList<>();
    for (E e : elements) {
      result.add(e);
    }
    return Collections.unmodifiableList(result);
  }
951067
public static Set<VariableElement>
            fieldsIn(Set<? extends Element> elements) {
        return setFilter(elements, FIELD_KINDS, VariableElement.class);
    }
1169167
public static <T> Level0ArrayOperator<Short[],Short> onArrayFor(final Short... elements) {
        return onArrayOf(Types.SHORT, VarArgsUtil.asRequiredObjectArray(elements));
    }
692283
private static String[] appendToStringArray(String[] array, String element) {
        if (array != null) {
            String[] newArray = new String[array.length + 1];
            System.arraycopy(array, 0, newArray, 0, array.length);
            newArray[array.length] = element;
            return newArray;
        } else {
            return new String[]{element};
        }
    }
432458
public static <T> Level0IndefiniteArrayOperator<T[],T> onArrayFor(final T... elements) {
        return new Level0IndefiniteArrayOperator<T[],T>(ExecutionTarget.forOp(VarArgsUtil.asRequiredObjectArray(elements), Normalisation.NONE));
    }
138655
public ElementsBuilder addAll(IsElement... elements) {
        for (IsElement element : elements) {
            add(element);
        }
        return that();
    }
713043
public static List<ExecutableElement>
            constructorsIn(Iterable<? extends Element> elements) {
        return listFilter(elements, CONSTRUCTOR_KIND, ExecutableElement.class);
    }
474570
public static <E> ArrayList<E> newArrayList(Iterator<? extends E> elements) {
		ArrayList<E> list = newArrayList();
		while (elements.hasNext()) {
			list.add(elements.next());
		}
		return list;
	}