io.github.vmzakharov.ecdataframe.dataframe.DfObjectColumn Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dataframe-ec Show documentation
Show all versions of dataframe-ec Show documentation
A tabular data structure based on the Eclipse Collections framework
package io.github.vmzakharov.ecdataframe.dataframe;
import io.github.vmzakharov.ecdataframe.dsl.value.Value;
import org.eclipse.collections.api.block.function.Function2;
import org.eclipse.collections.api.list.ImmutableList;
public interface DfObjectColumn
extends DfColumn
{
ImmutableList toList();
T getTypedObject(int rowIndex);
Value objectToValue(T anObject);
@Override
default Object getObject(int rowIndex)
{
return this.getTypedObject(rowIndex);
}
default IV injectIntoBreakOnNulls(
IV injectedValue,
Function2 function
)
{
IV result = injectedValue;
for (int i = 0; i < this.getSize(); i++)
{
T current = this.getTypedObject(i);
if (current == null)
{
return null;
}
result = function.apply(result, current);
if (result == null)
{
return null;
}
}
return result;
}
}