本文整理了Java中com.google.common.collect.Range.all
方法的一些代码示例,展示了Range.all
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Range.all
方法的具体详情如下:
包路径:com.google.common.collect.Range
类名称:Range
方法名:all
[英]Returns a range that contains every value of type C.
[中]
代码示例来源:origin: google/guava
Object readResolve() {
if (this.equals(ALL)) {
return all();
} else {
return this;
}
}
代码示例来源:origin: google/guava
@Override
public void clear() {
remove(Range.<C>all());
}
代码示例来源:origin: google/guava
@Empty
private static <C extends Comparable<?>> Range<C> generateRange() {
return Range.all();
}
代码示例来源:origin: google/guava
@Override
public boolean isEmpty() {
return upperBoundWindow.equals(Range.all())
? rangesByLowerBound.isEmpty()
: !entryIterator().hasNext();
}
}
代码示例来源:origin: google/guava
Object readResolve() {
if (ranges.isEmpty()) {
return of();
} else if (ranges.equals(ImmutableList.of(Range.all()))) {
return all();
} else {
return new ImmutableRangeSet<C>(ranges);
}
}
}
代码示例来源:origin: google/guava
@Override
public RangeMap<K, V> subRangeMap(Range<K> subRange) {
if (subRange.equals(Range.all())) {
return this;
} else {
return new SubRangeMap(subRange);
}
}
代码示例来源:origin: google/guava
@Override
public RangeSet<C> subRangeSet(Range<C> view) {
return view.equals(Range.<C>all()) ? this : new SubRangeSet(view);
}
代码示例来源:origin: google/guava
@Override
public int size() {
if (upperBoundWindow.equals(Range.all())) {
return rangesByLowerBound.size();
}
return Iterators.size(entryIterator());
}
代码示例来源:origin: google/guava
private RangeSet<Integer> expectedComplement(RangeSet<Integer> rangeSet) {
RangeSet<Integer> expected = TreeRangeSet.create();
expected.add(Range.<Integer>all());
expected.removeAll(rangeSet);
return expected;
}
代码示例来源:origin: google/guava
public void testRange_unboundedRange() {
assertEquals(
Range.closed(Integer.MIN_VALUE, Integer.MAX_VALUE),
ContiguousSet.create(Range.<Integer>all(), integers()).range());
assertEquals(
Range.atLeast(Integer.MIN_VALUE),
ContiguousSet.create(Range.<Integer>all(), integers()).range(CLOSED, OPEN));
assertEquals(
Range.all(), ContiguousSet.create(Range.<Integer>all(), integers()).range(OPEN, OPEN));
assertEquals(
Range.atMost(Integer.MAX_VALUE),
ContiguousSet.create(Range.<Integer>all(), integers()).range(OPEN, CLOSED));
}
代码示例来源:origin: google/guava
@GwtIncompatible // NavigableSet
public void testSubSet_unboundedRange() {
ImmutableSortedSet<Integer> set = ImmutableSortedSet.of(2, 4, 6, 8, 10);
assertEquals(set, Sets.subSet(set, Range.<Integer>all()));
}
代码示例来源:origin: google/guava
@GwtIncompatible // NavigableMap
public void testSubMap_unboundedRange() {
ImmutableSortedMap<Integer, Integer> map = ImmutableSortedMap.of(2, 0, 4, 0, 6, 0, 8, 0, 10, 0);
assertEquals(map, Maps.subMap(map, Range.<Integer>all()));
}
代码示例来源:origin: google/guava
public void testAll() {
Range<Integer> range = Range.all();
assertTrue(range.contains(Integer.MIN_VALUE));
assertTrue(range.contains(Integer.MAX_VALUE));
assertUnboundedBelow(range);
assertUnboundedAbove(range);
assertFalse(range.isEmpty());
assertEquals("(-\u221e..+\u221e)", range.toString());
assertSame(range, reserializeAndAssert(range));
assertSame(range, Range.all());
}
代码示例来源:origin: google/guava
public void testAddEmpty() {
TreeRangeSet<Integer> rangeSet = TreeRangeSet.create();
rangeSet.add(Range.closedOpen(3, 3));
testInvariants(rangeSet);
assertThat(rangeSet.asRanges()).isEmpty();
assertThat(rangeSet.complement().asRanges()).containsExactly(Range.<Integer>all());
}
代码示例来源:origin: google/guava
public void testFirst() {
assertEquals(1, ContiguousSet.create(Range.closed(1, 3), integers()).first().intValue());
assertEquals(1, ContiguousSet.create(Range.open(0, 4), integers()).first().intValue());
assertEquals(
Integer.MIN_VALUE,
ContiguousSet.create(Range.<Integer>all(), integers()).first().intValue());
}
代码示例来源:origin: google/guava
public void testLast() {
assertEquals(3, ContiguousSet.create(Range.closed(1, 3), integers()).last().intValue());
assertEquals(3, ContiguousSet.create(Range.open(0, 4), integers()).last().intValue());
assertEquals(
Integer.MAX_VALUE,
ContiguousSet.create(Range.<Integer>all(), integers()).last().intValue());
}
代码示例来源:origin: google/guava
public void testEquals() {
new EqualsTester()
.addEqualityGroup(Range.open(1, 5), Range.range(1, OPEN, 5, OPEN))
.addEqualityGroup(Range.greaterThan(2), Range.greaterThan(2))
.addEqualityGroup(Range.all(), Range.all())
.addEqualityGroup("Phil")
.testEquals();
}
代码示例来源:origin: google/guava
public void testAll() {
ImmutableRangeSet<Integer> rangeSet = ImmutableRangeSet.all();
assertThat(rangeSet.asRanges()).contains(Range.<Integer>all());
assertTrue(rangeSet.contains(0));
assertTrue(rangeSet.intersects(Range.singleton(0)));
assertTrue(rangeSet.intersects(Range.<Integer>all()));
assertTrue(rangeSet.encloses(Range.<Integer>all()));
assertTrue(rangeSet.enclosesAll(rangeSet));
assertEquals(ImmutableRangeSet.<Integer>of(), rangeSet.complement());
}
代码示例来源:origin: google/guava
public void testNullPointers() {
NullPointerTester tester = new NullPointerTester();
tester.testAllPublicStaticMethods(Range.class);
tester.testAllPublicStaticMethods(Range.class);
tester.testAllPublicInstanceMethods(Range.all());
tester.testAllPublicInstanceMethods(Range.open(1, 3));
}
}
代码示例来源:origin: google/guava
public void testCanonical_unboundedDomain() {
assertEquals(Range.lessThan(0), Range.lessThan(0).canonical(UNBOUNDED_DOMAIN));
assertEquals(Range.lessThan(1), Range.atMost(0).canonical(UNBOUNDED_DOMAIN));
assertEquals(Range.atLeast(0), Range.atLeast(0).canonical(UNBOUNDED_DOMAIN));
assertEquals(Range.atLeast(1), Range.greaterThan(0).canonical(UNBOUNDED_DOMAIN));
assertEquals(Range.all(), Range.<Integer>all().canonical(UNBOUNDED_DOMAIN));
}
内容来源于网络,如有侵权,请联系作者删除!