@Override
    public <K, V> Map<K, V> asMap(Class<K> keyClass, Class<V> valueClass) {
        if (keyClass == null || valueClass == null) {
            throw new IllegalArgumentException("Non-null key and value classes are required");
        }
        Object[][] values = getValue();
        int len = values.length;
        if (len == 0) {
            return Collections.emptyMap();
        }

        Map<K, V> map = new LinkedHashMap<>();
        int size = columns.size();
        if (len == 1 && !valueClass.isArray()) {
            for (int i = 0; i < size; i++) {
                map.put(keyClass.cast(columns.get(i).getColumnName()), valueClass.cast(values[i][0]));
            }
        } else if (!valueClass.isArray()) {
            throw new IllegalArgumentException("Value class should be array");
        }

        Class<?> compClass = valueClass.getComponentType();
        if (compClass == Object.class) {
            for (int i = 0; i < size; i++) {
                Object[] v = new Object[len];
                for (int j = 0; j < len; j++) {
                    v[j] = values[j][i];
                }
                map.put(keyClass.cast(columns.get(i).getColumnName()), valueClass.cast(v));
            }
        } else {
            for (int i = 0; i < size; i++) {
                Object[] v = (Object[]) Array.newInstance(compClass, len);
                for (int j = 0; j < len; j++) {
                    v[j] = compClass.cast(values[j][i]);
                }
                map.put(keyClass.cast(columns.get(i).getColumnName()), valueClass.cast(v));
            }
        }
        // why not use Collections.unmodifiableMap(map) here?
        return map;
    }
Gets immutable list of nested columns.

@return immutable list of columns
clickhouse-data/src/main/java/com/clickhouse/data/value/ClickHouseNestedValue.java