class _Arrays {

    public static <T> Optional<T> get(@Nullable T[] array, int index) {
        val size = _NullSafe.size(array);
        if(size==0) {
            return Optional.empty();
        }
        val minIndex = 0;
        val maxIndex = size - 1;
        if(index < minIndex ||  index > maxIndex) {
            return Optional.empty();
        }
        return Optional.ofNullable(array[index]);
    }

}