Returns a new array of the given length with the specified component type. @param type the component type @param length the length of the new array
(Class<@NonNull T> type, int length)
| 47 | * @param length the length of the new array |
| 48 | */ |
| 49 | @GwtIncompatible // Array.newInstance(Class, int) |
| 50 | @SuppressWarnings("unchecked") |
| 51 | public static <T extends @Nullable Object> T[] newArray(Class<@NonNull T> type, int length) { |
| 52 | return (T[]) Array.newInstance(type, length); |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Returns a new array of the given length with the same type as a reference array. |