Skip to content

Instantly share code, notes, and snippets.

@wf-adamhei
Created February 6, 2021 02:34
Show Gist options
  • Save wf-adamhei/52058ee7d5ddf2e7fe1c751b6d5cdf67 to your computer and use it in GitHub Desktop.
Save wf-adamhei/52058ee7d5ddf2e7fe1c751b6d5cdf67 to your computer and use it in GitHub Desktop.
def partitionTestClassNames(classNames, buckets) {
def subArrays = []
def bucketSize = classNames.size() / buckets
for (int i = 0; i < buckets; i++) {
def start = i * bucketSize
def end = i == buckets - 1 ? classNames.size() : start + bucketSize
subArrays += [classNames[start..<end]]
}
return subArrays
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment