io.deephaven.chunk.util.ObjectChunkIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of deephaven-engine-chunk Show documentation
Show all versions of deephaven-engine-chunk Show documentation
Engine Chunks: Array-like data structures for dense, efficient data movement
The newest version!
//
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending
//
package io.deephaven.chunk.util;
import io.deephaven.chunk.ObjectChunk;
import io.deephaven.chunk.attributes.Any;
import org.jetbrains.annotations.NotNull;
import java.util.Iterator;
public class ObjectChunkIterator implements Iterator {
private final ObjectChunk chunk;
private final int limit;
private int next;
public ObjectChunkIterator(@NotNull final ObjectChunk chunk) {
this(chunk, 0, chunk.size());
}
public ObjectChunkIterator(@NotNull final ObjectChunk chunk, final int offset,
final int length) {
this.chunk = chunk;
this.next = offset;
this.limit = offset + length;
}
@Override
public boolean hasNext() {
return next < limit;
}
@Override
public TYPE next() {
return chunk.get(next++);
}
}