Example usage for java.util AbstractList set

List of usage examples for java.util AbstractList set

Introduction

In this page you can find the example usage for java.util AbstractList set.

Prototype

public E set(int index, E element) 

Source Link

Usage

From source file:org.apache.hadoop.hive.metastore.Warehouse.java

/**
 * Extracts values from partition name without the column names.
 * @param name Partition name./*  w w w.j  av a  2s.co  m*/
 * @param result The result. Must be pre-sized to the expected number of columns.
 */
public static AbstractList<String> makeValsFromName(String name, AbstractList<String> result)
        throws MetaException {
    assert name != null;
    String[] parts = slash.split(name, 0);
    if (result == null) {
        result = new ArrayList<>(parts.length);
        for (int i = 0; i < parts.length; ++i) {
            result.add(null);
        }
    } else if (parts.length != result.size()) {
        throw new MetaException(
                "Expected " + result.size() + " components, got " + parts.length + " (" + name + ")");
    }
    for (int i = 0; i < parts.length; ++i) {
        int eq = parts[i].indexOf('=');
        if (eq <= 0) {
            throw new MetaException("Unexpected component " + parts[i]);
        }
        result.set(i, unescapePathName(parts[i].substring(eq + 1)));
    }
    return result;
}