Duplicate of fromArray() to keep fromArray() monomorphic.
497629
function fromTypedArray (that, array) {
  var length = checked(array.length) | 0
  that = allocate(that, length)
  // Truncating the elements is probably not what people expect from typed
  // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior
  // of the old Buffer constructor.
  for (var i = 0; i < length; i += 1) {
    that[i] = array[i] & 255
  }
  return that
}
345186
@ReplacedBy("com.google.common.collect.Iterables#toArray()")
    public static <T> T[] toArray (Collection<? extends T> col, Class<T> type)
    {
        @SuppressWarnings("unchecked")
        T[] array = (T[]) Array.newInstance(type, col.size());
        return col.toArray(array);
    }
424551
@Override
	public <T> T[] toArray(T[] a) {
		combine();
		if(combined==null) {
			Set<E> emptySet = java.util.Collections.emptySet();
			return emptySet.toArray(a);
		}
		return combined.toArray(a);
	}
1094771
public static <T> T[] sub(T[] array, int start, int end) {
		int length = length(array);
		if (start < 0) {
			start += length;
		}
		if (end < 0) {
			end += length;
		}
		if (start == length) {
			return newArray(array.getClass().getComponentType(), 0);
		}
		if (start > end) {
			int tmp = start;
			start = end;
			end = tmp;
		}
		if (end > length) {
			if (start >= length) {
				return newArray(array.getClass().getComponentType(), 0);
			}
			end = length;
		}
		return Arrays.copyOfRange(array, start, end);
	}
115084
@SuppressWarnings("unchecked")
    public static <T> T[] cloneArray(T[] original) {
        if (original == null) {
            return null;
        }

        try {
            Class<?> clazz = original.getClass().getComponentType();
            T[] copy = (T[]) Array.newInstance(clazz, original.length);
            if (copy.length != 0) {
                Constructor<T> copyConstructor = (Constructor<T>) clazz.getConstructor(clazz);
                int i = 0;
                for (T t : original) {
                    copy[i++] = copyConstructor.newInstance(t);
                }
            }
            return copy;
        } catch (Exception e) {
            throw new RuntimeException("Cannot copy array. Does its type have a copy-constructor? " + original, e);
        }
    }
763481
function cloneTypedArray$1(typedArray, isDeep) {
  var buffer = isDeep ? cloneArrayBuffer$3(typedArray.buffer) : typedArray.buffer;
  return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
}
382961
public static <T extends Comparable<? super T>> T[] asc(final T[] comparableArray) {

        if (comparableArray == null) {
            return null;
        }
        T[] clone = comparableArray.clone();
        ascByReflex(clone);
        return clone;
    }
61994
public static <T, J extends Convertable<T>> T[] convertToArray(J[] array) {
        return toArray(convert(array));
    }
523422
function ( array, from, to ) {

		if ( AnimationUtils.isTypedArray( array ) ) {

			// in ios9 array.subarray(from, undefined) will return empty array
			// but array.subarray(from) or array.subarray(from, len) is correct
			return new array.constructor( array.subarray( from, to !== undefined ? to : array.length ) );

		}

		return array.slice( from, to );

	}
315454
public static <T> T[] deleteRange(final T[] a, final int fromIndex, final int toIndex) {
        N.checkFromToIndex(fromIndex, toIndex, a.length);

        if (fromIndex == toIndex) {
            return a.clone();
        }

        final T[] b = Array.newInstance(a.getClass().getComponentType(), a.length - (toIndex - fromIndex));

        if (fromIndex > 0) {
            N.copy(a, 0, b, 0, fromIndex);
        }

        if (toIndex < a.length) {
            N.copy(a, toIndex, b, fromIndex, a.length - toIndex);
        }

        return b;
    }
692736
@SuppressWarnings("unchecked")
   private static <T> T[] finishToArray(T[] r, Iterator<?> it) {
      int i = r.length;
      while (it.hasNext()) {
         int cap = r.length;
         if (i == cap) {
            int newCap = cap + (cap >> 1) + 1;
            // overflow-conscious code
            if (newCap - MAX_ARRAY_SIZE > 0)
               newCap = hugeCapacity(cap + 1);
            r = Arrays.copyOf(r, newCap);
         }
         r[i++] = (T)it.next();
      }
      // trim if overallocated
      return (i == r.length) ? r : Arrays.copyOf(r, i);
   }
487616
public static INDArray[] dup(INDArray[] history) {
        INDArray[] dupHistory = new INDArray[history.length];
        for (int i = 0; i < history.length; i++) {
            dupHistory[i] = history[i].dup();
        }
        return dupHistory;
    }
642164
public function fromArray(array $fromArray) // type is given in derived class
    {
        foreach ($fromArray as $key => $value) {
            $camelCaseKey = CaseHelperFactory::make(CaseHelperFactory::INPUT_TYPE_SNAKE_CASE)->toCamelCase($key);

            if (!property_exists($this, $camelCaseKey)) {
                continue;
            }

            switch ($key) {
                case 'creator':
                    $this->{$key} = (new AccountType)->fromArray(['email' => $value]);
                    break;
                case 'create_time':
                case 'ctime':
                case 'mtime':
                case 'mtime_created':
                    $this->{$camelCaseKey} = $this->getDateTime((int)$value);
                    break;
                default:
                    $this->{$camelCaseKey} = $value;
                    break;
            }
        }

        return $this;
    }
626830
public static float[] copyOf(float[] floatArray) {

    	float[] copy = new float[floatArray.length];
        System.arraycopy(floatArray, 0, copy, 0, floatArray.length);
        return copy;
    }
141490
public static <T> T[] copyOfRange(final T[] original, final int from, final int to, final int step) {
        return copyOfRange(original, from, to, step, (Class<T[]>) original.getClass());
    }
225422
public static void deepCopy(Object from, Object to) {
		if (from == null) throw new IllegalArgumentException("from must not be null");
		if (to == null) throw new IllegalArgumentException("to must not be null");
		if (from.getClass() != to.getClass()) throw new IllegalArgumentException("from and to must have exactly same class, from has " + from.getClass() + " to has " + to.getClass());

		try {
			_deepCopy(from, to, new ArrayList(), new ArrayList());
		} catch (IllegalAccessException | IllegalArgumentException x) {
			throw new RuntimeException(x);
		}
	}
860184
public void newarray(TypeMirror type, int count) throws IOException
    {
        if (type.getKind() != TypeKind.ARRAY)
        {
            throw new IllegalArgumentException(type+" is not array");
        }
        ArrayType at = (ArrayType) type;
        iconst(count);
        TypeMirror ct = at.getComponentType();
        switch (ct.getKind())
        {
            case BOOLEAN:
                newarray(T_BOOLEAN);
                break;
            case CHAR:
                newarray(T_CHAR);
                break;
            case FLOAT:
                newarray(T_FLOAT);
                break;
            case DOUBLE:
                newarray(T_DOUBLE);
                break;
            case BYTE:
                newarray(T_BYTE);
                break;
            case SHORT:
                newarray(T_SHORT);
                break;
            case INT:
                newarray(T_INT);
                break;
            case LONG:
                newarray(T_LONG);
                break;
            case DECLARED:
            {
                DeclaredType dt = (DeclaredType) ct;
                int index = subClass.resolveClassIndex((TypeElement)dt.asElement());
                anewarray(index);
            }
                break;
            default:
                throw new IllegalArgumentException(type+" not supported");
        }
    }