io.deephaven.engine.table.iterators.ObjectColumnIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of deephaven-engine-api Show documentation
Show all versions of deephaven-engine-api Show documentation
Engine API: Engine API module, suitable as a compile-time dependency for most queries
The newest version!
//
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending
//
package io.deephaven.engine.table.iterators;
import io.deephaven.util.annotations.FinalDefault;
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
/**
* {@link ColumnIterator} implementation for columns of {@link Object objects}.
*/
public interface ObjectColumnIterator extends ColumnIterator {
/**
* Create a {@link Stream} over the remaining elements of this ObjectColumnIterator. The result must be
* {@link java.util.stream.BaseStream#close() closed} in order to ensure resources are released. A
* try-with-resources block is strongly encouraged.
*
* @return A {@link Stream} over the remaining contents of this iterator. Must be {@link Stream#close() closed}.
*/
@Override
@FinalDefault
default Stream stream() {
return StreamSupport.stream(
Spliterators.spliterator(
this,
remaining(),
Spliterator.IMMUTABLE | Spliterator.ORDERED),
false)
.onClose(this::close);
}
}