I hereby claim:
- I am primetalk on github.
- I am zhizhelev (https://keybase.io/zhizhelev) on keybase.
- I have a public key ASDZcrUUlHnt8K5S-e3r-7ez1Iw8sYd7_N1geP9suA7Dqgo
To claim this, I am signing this object:
import java.util.*; | |
import java.util.stream.Stream; | |
public final class StreamUtils { | |
public static <A> Stream<List<A>> sliced(final Stream<A> stm, final int sliceSize){ | |
final ArrayList<A> lst = new ArrayList<>(sliceSize); | |
final int[] cnt = {0}; | |
final Stream<ArrayList<A>> sliced = stm.flatMap(el -> { | |
if (cnt[0] == sliceSize) { | |
cnt[0] = 0; |
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env scala-cli | |
// Usage: | |
// 1. Install scala-cli as described here: https://scala-cli.virtuslab.org/install/ | |
// (For macos it's: `brew install Virtuslab/scala-cli/scala-cli`) | |
// 2. Run `scala-cli <this gist url> <original-file>.csv <count of same value chunks> <chunk id field> | |
// 3. It'll produce many smaller files each of which will contain the requested number of | |
// line chunks with the same identifier. | |
// For each line it'll get the field and compare with the previous line. If it's new, | |
// then counter is incremented. | |
// After size it'll emit a new file. |