All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.intelie.pipes.ArrayRow Maven / Gradle / Ivy

There is a newer version: 0.25.5
Show newest version
package net.intelie.pipes;

import static net.intelie.pipes.util.Preconditions.checkNotNull;

public class ArrayRow extends AbstractRow {
    private static final long serialVersionUID = 1L;
    private final Object[] values;

    public ArrayRow(Object... values) {
        checkNotNull(values, "values array cannot be null");
        this.values = values;
    }

    public static ArrayRow concat(Row... rows) {
        int size = 0;
        for (Row row : rows)
            size += row.size();

        Object[] newValues = new Object[size];

        int i = 0;
        for (Row row : rows) {
            int thisSize = row.size();
            for (int j = 0; j < thisSize; j++)
                newValues[i++] = row.get(j);
        }

        return new ArrayRow(newValues);

    }

    @Override
    public int size() {
        return values.length;
    }

    @Override
    public Object get(int index) {
        return values[index];
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy