ByteKeyRange implements Serializable,
        HasDefaultTracker<
            ByteKeyRange, org.apache.beam.sdk.transforms.splittabledofn.ByteKeyRangeTracker> { public List<ByteKey> split(int numSplits) { checkArgument(numSplits > 0, "numSplits %s must be a positive integer", numSplits); try { ImmutableList.Builder<ByteKey> ret = ImmutableList.builder(); ret.add(startKey); for (int i = 1; i < numSplits; ++i) { ret.add(interpolateKey(i / (double) numSplits)); } ret.add(endKey); return ret.build(); } catch (IllegalStateException e) { return ImmutableList.of(startKey, endKey); } } private  ByteKeyRange(ByteKey startKey, ByteKey endKey); static ByteKeyRange of(ByteKey startKey, ByteKey endKey); ByteKey getStartKey(); ByteKey getEndKey(); Boolean containsKey(ByteKey key); Boolean overlaps(ByteKeyRange other); List<ByteKey> split(int numSplits); double estimateFractionForKey(ByteKey key); ByteKey interpolateKey(double fraction); ByteKeyRange withStartKey(ByteKey startKey); ByteKeyRange withEndKey(ByteKey endKey); @Override String toString(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override org.apache.beam.sdk.transforms.splittabledofn.ByteKeyRangeTracker newTracker(); static final ByteKeyRange ALL_KEYS; }
@Test public void testRejectsInvalidSplit() { try { fail(String.format("%s.split(0) should fail: %s", RANGE_1_10, RANGE_1_10.split(0))); } catch (IllegalArgumentException expected) { } try { fail(String.format("%s.split(-3) should fail: %s", RANGE_1_10, RANGE_1_10.split(-3))); } catch (IllegalArgumentException expected) { } }