@Test public void mergeOverlappingRangeShouldOutputMergedRange() { List<UidRange> actual = UidRange .mergeRanges( ImmutableList.of( new UidRange(_1, _3), new UidRange(_3, _4))); assertThat(actual).containsOnly(new UidRange(_1, _4)); }
public static List<UidRange> mergeRanges(List<UidRange> ranges) { if (ranges.isEmpty()) { return ranges; } RangeSet<MessageUid> rangeSet = createSortedRangeSet(ranges); List<Range<MessageUid>> mergedRanges = mergeContiguousRanges(rangeSet); return toUidRanges(mergedRanges); }
UidRange implements Iterable<MessageUid> { public static List<UidRange> mergeRanges(List<UidRange> ranges) { if (ranges.isEmpty()) { return ranges; } RangeSet<MessageUid> rangeSet = createSortedRangeSet(ranges); List<Range<MessageUid>> mergedRanges = mergeContiguousRanges(rangeSet); return toUidRanges(mergedRanges); } }
UidRange implements Iterable<MessageUid> { public static List<UidRange> mergeRanges(List<UidRange> ranges) { if (ranges.isEmpty()) { return ranges; } RangeSet<MessageUid> rangeSet = createSortedRangeSet(ranges); List<Range<MessageUid>> mergedRanges = mergeContiguousRanges(rangeSet); return toUidRanges(mergedRanges); } UidRange(MessageUid singleVal);  UidRange(MessageUid minValue, MessageUid messageUid); }
UidRange implements Iterable<MessageUid> { public static List<UidRange> mergeRanges(List<UidRange> ranges) { if (ranges.isEmpty()) { return ranges; } RangeSet<MessageUid> rangeSet = createSortedRangeSet(ranges); List<Range<MessageUid>> mergedRanges = mergeContiguousRanges(rangeSet); return toUidRanges(mergedRanges); } UidRange(MessageUid singleVal);  UidRange(MessageUid minValue, MessageUid messageUid); static String toString(UidRange[] ranges); static List<UidRange> mergeRanges(List<UidRange> ranges); MessageUid getLowVal(); MessageUid getHighVal(); boolean includes(MessageUid value); int hashCode(); boolean equals(Object obj); String toString(); String getFormattedString(); @Override Iterator<MessageUid> iterator(); MessageRange toMessageRange(); }
UidRange implements Iterable<MessageUid> { public static List<UidRange> mergeRanges(List<UidRange> ranges) { if (ranges.isEmpty()) { return ranges; } RangeSet<MessageUid> rangeSet = createSortedRangeSet(ranges); List<Range<MessageUid>> mergedRanges = mergeContiguousRanges(rangeSet); return toUidRanges(mergedRanges); } UidRange(MessageUid singleVal);  UidRange(MessageUid minValue, MessageUid messageUid); static String toString(UidRange[] ranges); static List<UidRange> mergeRanges(List<UidRange> ranges); MessageUid getLowVal(); MessageUid getHighVal(); boolean includes(MessageUid value); int hashCode(); boolean equals(Object obj); String toString(); String getFormattedString(); @Override Iterator<MessageUid> iterator(); MessageRange toMessageRange();  }