Here you can find the source of emptyArray(Class
@SuppressWarnings("unchecked") public static <T> T[] emptyArray(Class<T> kind)
import java.lang.reflect.Array; public class Main{ private static final int CACHE_SIZE = 73; private static Object[] EMPTY = new Object[0]; private static Object[] sCache = new Object[CACHE_SIZE]; @SuppressWarnings("unchecked") public static <T> T[] emptyArray(Class<T> kind) { if (kind == Object.class) { return (T[]) EMPTY; }/* w w w.j a v a2 s . c om*/ int bucket = (System.identityHashCode(kind) / 8 & 0x7FFFFFFF) % CACHE_SIZE; Object cache = sCache[bucket]; if (cache == null || cache.getClass().getComponentType() != kind) { cache = Array.newInstance(kind, 0); sCache[bucket] = cache; } return (T[]) cache; } }