Skip to content

Commit

Permalink
IntSeq chunked iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuken committed Oct 6, 2024
1 parent e2aba22 commit 89c7f1a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions arc-core/src/arc/struct/IntSeq.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ public int sum(){
return sum;
}

public void chunked(int chunkSize, Cons<int[]> iterator){
for(int i = 0; i < size; i += chunkSize){
int[] slice = Arrays.copyOfRange(items, i, Math.min(i + chunkSize, size));
iterator.get(slice);
}
}

/**
* Adds a value if it was already not in this sequence.
* @return whether this value was not present in this sequence.
Expand Down

0 comments on commit 89c7f1a

Please sign in to comment.