/*
(non-Javadoc)

@see
javax.persistence.criteria.CriteriaBuilder#array(javax.persistence.criteria
.Selection<?>[])
433503
@Override
    public CompoundSelection<Object[]> array(Selection<?>... arg0)
    {
        return new DefaultCompoundSelection<Object[]>(Arrays.asList(arg0), Object.class);
    }
1206325
public static <T> List<T> toList(final T[] array) {

    if (array != null) {
      List<T> list = new ArrayList<T>(array.length);
      for (T element : array) {
        list.add(element);
      }
      return list;
    } else {
      return new ArrayList<T>(0);
    }
  }
1333109
public function selectArray($fields = null, $where = null, $orderBy = null, $limit = null): array
    {
        return self::select2($fields, $where, $orderBy, $limit);
    }
57304
@SafeVarargs
    public static <V extends Comparable<V>> V[] sort(V... array) {
        Arrays.sort(array);
        return array;
    }
234579
public static <T extends Comparable<? super T>>
    void quickSelect( T[] arr, int k )
    {
        quickSelect( arr, 0, arr.length - 1, k );
    }
999589
public static <T> QueryParameterValue array(T[] array, Class<T> clazz) {
    return array(array, classToType(clazz));
  }
169883
private void buildSelect(final StringBuilder selectBuilder, final List<Projection> projections) {
        selectBuilder.append("SELECT ");
        if (null == projections || projections.isEmpty()) {
            selectBuilder.append(" * ");

            return;
        }

        selectBuilder.append(projections.stream().map(Projection::getKey).collect(Collectors.joining(", ")));
    }
1264424
@SuppressWarnings("unchecked")
    @Override
    public final <AT> AT[] toArray(AT[] a) {
        this.readLock.lock();
        try {
            // Verify the array size
            if (a.length < this.size) {
                a =
                        (AT[])
                                java.lang.reflect.Array.newInstance(
                                        a.getClass().getComponentType(), this.size);
            }

            // Trick to avoid generics warning
            final Object[] result = a;

            // Copy over all elements
            int index = 0;
            for (final Queue<T> queue : this.keyedQueues.values()) {
                for (final T e : queue) {
                    result[index++] = e;
                }
            }

            // If array is too big set next element null
            if (a.length > this.size) {
                a[this.size] = null;
            }

            return a;
        } finally {
            this.readLock.unlock();
        }
    }
933198
public void setOptions(final Object[] aArray) {
		setOptions(aArray == null ? null : Arrays.asList(aArray));
	}
914408
public static <T, J extends Convertable<T>> ArrayList<T> convert(J[] array) {
        return convert(array == null ? null : Arrays.asList(array));
    }
836182
public DAO[] executeSelect(String sql, Object[] parameters)
			throws DatabaseException {
		ResultSet rs = executeSelectSQL(sql, parameters, null, false);
		return resultSetToDAO(rs, null);
	}
176924
public static Object convertArray(Connection conn, Object[] array) throws SQLException {
        Object result = null;

        result = createArrayOf(conn, convertJavaClassToSqlType(array.getClass().getComponentType().getSimpleName()), array);

        return result;
    }
224191
public static <T extends Comparable<? super T>> T[] desc(final T[] comparableArray) {

        if (comparableArray == null) {
            return null;
        }
        T[] clone = comparableArray.clone();
        descByReflex(clone);
        return clone;
    }
162093
public SelectionType getSelection(final Method method) {
        final Annotation[] annotations = method.getAnnotations();
        return getSelection(annotations);
    }
160095
public int[] getSelectedComponents ()
    {
        int[] values = new int[_selected.size()];
        Iterator<Integer> iter = _selected.values().iterator();
        for (int ii = 0; iter.hasNext(); ii++) {
            values[ii] = iter.next().intValue();
        }
        return values;
    }
933764
private void _serializeArray(PageContext pc, Set test, Array array, StringBuilder sb, boolean serializeQueryByColumns, Set<Object> done) throws ConverterException {
	_serializeList(pc, test, array.toList(), sb, serializeQueryByColumns, done);
    }
686092
public static <T extends Number> int[] asArray(final T... array) {
        int[] b = new int[array.length];
        for (int i = 0; i < b.length; i++) {
            b[i] = array[i].intValue();
        }
        return b;
    }