T[] array = toArray();
Class<?> componentType = array.getClass().getComponentType();
if (componentType.equals(Byte.class)) {
return (ArrayWrapper<T>) new ByteArrayWrapper((Byte[]) array);
} else if (componentType.equals(Short.class)) {
return (ArrayWrapper<T>) new ShortArrayWrapper((Short[]) array);
} else if (componentType.equals(Integer.class)) {
return (ArrayWrapper<T>) new IntegerArrayWrapper((Integer[]) array);
} else if (componentType.equals(Long.class)) {
return (ArrayWrapper<T>) new LongArrayWrapper((Long[]) array);
} else if (componentType.equals(Character.class)) {