Java Array Copy copyOfRange(U[] original, int from, int to, Class newType)

Here you can find the source of copyOfRange(U[] original, int from, int to, Class newType)

Description

Same as Arrays#copyOfRange(Object[],int,int,Class)

License

Open Source License

Declaration

public static <T, U> T[] copyOfRange(U[] original, int from, int to, Class<? extends T[]> newType) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2007, 2014 Bruno Medeiros and other Contributors.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors://from   w w w .  ja  v  a  2  s  . c o  m
 *     Bruno Medeiros - initial implementation
 *******************************************************************************/

import java.util.Arrays;

public class Main {
    /** Same as {@link Arrays#copyOfRange(Object[], int, int)} */
    public static <T> T[] copyOfRange(T[] original, int from, int to) {
        return Arrays.copyOfRange(original, from, to);
    }

    /** Same as {@link Arrays#copyOfRange(Object[], int, int, Class)} */
    public static <T, U> T[] copyOfRange(U[] original, int from, int to, Class<? extends T[]> newType) {
        return Arrays.copyOfRange(original, from, to, newType);
    }
}

Related

  1. copyOf(T[] array)
  2. copyOf(T[] array, int count)
  3. copyOf(T[] original)
  4. copyOf(T[] original)
  5. copyOfBytes(final byte[] bytes)
  6. copyStringArray(String[] str, int startingPos)
  7. getArrayCopy(byte[] array)
  8. getArrayCopy(String[] data)
  9. memcpy(Object dest, Object src, int length)