Here you can find the source of resizeNoAutoInit(T[] oldarray, int newsize)
Parameter | Description |
---|---|
T | a parameter |
oldarray | a parameter |
newsize | a parameter |
public static final <T> T[] resizeNoAutoInit(T[] oldarray, int newsize)
//package com.java2s; //License from project: Open Source License import java.util.Arrays; public class Main { /**// w w w . j a v a2s . c om * Resize an array without autoinitialization. Same as Arrays.copyOf(..), just * prints a message. * * @param <T> * @param oldarray * @param newsize * @return */ public static final <T> T[] resizeNoAutoInit(T[] oldarray, int newsize) { // For non-autoinit types, this is enough. T[] tmp = Arrays.copyOf(oldarray, newsize); System.out .printf("Old array of type %s resized without auto-init. New capacity: %d\n", tmp.getClass().getComponentType(), newsize); return tmp; } }