Skip to content

Instantly share code, notes, and snippets.

@AnkitKiet
Created August 9, 2020 05:27
Show Gist options
  • Save AnkitKiet/6c1f5cd57a476a02bc6bdf43fab676f8 to your computer and use it in GitHub Desktop.
Save AnkitKiet/6c1f5cd57a476a02bc6bdf43fab676f8 to your computer and use it in GitHub Desktop.
@Benchmark
public void C3_hugeListStreamPartitioned() {
final List<List<Integer>> result = list.stream()
.collect(partitioned(chunkSize));
assertThat(result).hasSize(expectedSize);
assertThat(result.get(chunkIndex)).isEqualTo(expectedChunk);
}
@Benchmark
public void C4_hugeListToPartition() {
final List<List<Integer>> result = Partition.ofSize(list, chunkSize); //Here Using Custom Partition Class
assertThat(result).hasSize(expectedSize);
assertThat(result.get(chunkIndex)).isEqualTo(expectedChunk);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment