com.google.common.collect.Range.downTo()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(161)

本文整理了Java中com.google.common.collect.Range.downTo方法的一些代码示例,展示了Range.downTo的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Range.downTo方法的具体详情如下:
包路径:com.google.common.collect.Range
类名称:Range
方法名:downTo

Range.downTo介绍

[英]Returns a range from the given endpoint, which may be either inclusive (closed) or exclusive (open), with no upper bound.
[中]

代码示例

代码示例来源:origin: google/guava

@Override
public NavigableMap<Cut<C>, Range<C>> tailMap(Cut<C> fromKey, boolean inclusive) {
 return subMap(Range.downTo(fromKey, BoundType.forBoolean(inclusive)));
}

代码示例来源:origin: google/guava

@Override
public NavigableMap<Cut<C>, Range<C>> tailMap(Cut<C> fromKey, boolean inclusive) {
 return subMap(Range.downTo(fromKey, BoundType.forBoolean(inclusive)));
}

代码示例来源:origin: google/guava

@Override
ContiguousSet<C> tailSetImpl(C fromElement, boolean inclusive) {
 return intersectionInCurrentDomain(Range.downTo(fromElement, BoundType.forBoolean(inclusive)));
}

代码示例来源:origin: google/guava

@Override
public NavigableMap<Cut<C>, Range<C>> tailMap(Cut<C> fromKey, boolean inclusive) {
 return subMap(Range.downTo(fromKey, BoundType.forBoolean(inclusive)));
}

代码示例来源:origin: google/j2objc

@Override
public NavigableMap<Cut<C>, Range<C>> tailMap(Cut<C> fromKey, boolean inclusive) {
 return subMap(Range.downTo(fromKey, BoundType.forBoolean(inclusive)));
}

代码示例来源:origin: google/j2objc

@Override
public NavigableMap<Cut<C>, Range<C>> tailMap(Cut<C> fromKey, boolean inclusive) {
 return subMap(Range.downTo(fromKey, BoundType.forBoolean(inclusive)));
}

代码示例来源:origin: google/j2objc

@Override
ContiguousSet<C> tailSetImpl(C fromElement, boolean inclusive) {
 return intersectionInCurrentDomain(Range.downTo(fromElement, BoundType.forBoolean(inclusive)));
}

代码示例来源:origin: google/j2objc

@Override
public NavigableMap<Cut<C>, Range<C>> tailMap(Cut<C> fromKey, boolean inclusive) {
 return subMap(Range.downTo(fromKey, BoundType.forBoolean(inclusive)));
}

代码示例来源:origin: wildfly/wildfly

@Override
public NavigableMap<Cut<C>, Range<C>> tailMap(Cut<C> fromKey, boolean inclusive) {
 return subMap(Range.downTo(fromKey, BoundType.forBoolean(inclusive)));
}

代码示例来源:origin: wildfly/wildfly

@Override
public NavigableMap<Cut<C>, Range<C>> tailMap(Cut<C> fromKey, boolean inclusive) {
 return subMap(Range.downTo(fromKey, BoundType.forBoolean(inclusive)));
}

代码示例来源:origin: wildfly/wildfly

@Override
public NavigableMap<Cut<C>, Range<C>> tailMap(Cut<C> fromKey, boolean inclusive) {
 return subMap(Range.downTo(fromKey, BoundType.forBoolean(inclusive)));
}

代码示例来源:origin: wildfly/wildfly

@Override
ContiguousSet<C> tailSetImpl(C fromElement, boolean inclusive) {
 return intersectionInCurrentDomain(Range.downTo(fromElement, BoundType.forBoolean(inclusive)));
}

代码示例来源:origin: google/guava

public void testFromRangeOneEnd() {
 for (BoundType endpointType : BoundType.values()) {
  assertEquals(
    GeneralRange.upTo(Ordering.natural(), 3, endpointType),
    GeneralRange.from(Range.upTo(3, endpointType)));
  assertEquals(
    GeneralRange.downTo(Ordering.natural(), 3, endpointType),
    GeneralRange.from(Range.downTo(3, endpointType)));
 }
}

代码示例来源:origin: apache/incubator-druid

private static Range<Long> toLongRange(final Range<BoundValue> range)
 {
  if (!range.hasUpperBound() && !range.hasLowerBound()) {
   return Range.all();
  } else if (range.hasUpperBound() && !range.hasLowerBound()) {
   return Range.upTo(Long.parseLong(range.upperEndpoint().getValue()), range.upperBoundType());
  } else if (!range.hasUpperBound() && range.hasLowerBound()) {
   return Range.downTo(Long.parseLong(range.lowerEndpoint().getValue()), range.lowerBoundType());
  } else {
   return Range.range(
     Long.parseLong(range.lowerEndpoint().getValue()), range.lowerBoundType(),
     Long.parseLong(range.upperEndpoint().getValue()), range.upperBoundType()
   );
  }
 }
}

代码示例来源:origin: com.fasterxml.jackson.datatype/jackson-datatype-guava

@Override
  public Range<C> call() throws Exception {
    return Range.downTo(lowerEndpoint, lowerBoundType);
  }
}, legacyDownToMethod, lowerEndpoint, lowerBoundType);

代码示例来源:origin: google/guava

public void testEquivalentFactories() {
  new EqualsTester()
    .addEqualityGroup(Range.all())
    .addEqualityGroup(Range.atLeast(1), Range.downTo(1, CLOSED))
    .addEqualityGroup(Range.greaterThan(1), Range.downTo(1, OPEN))
    .addEqualityGroup(Range.atMost(7), Range.upTo(7, CLOSED))
    .addEqualityGroup(Range.lessThan(7), Range.upTo(7, OPEN))
    .addEqualityGroup(Range.open(1, 7), Range.range(1, OPEN, 7, OPEN))
    .addEqualityGroup(Range.openClosed(1, 7), Range.range(1, OPEN, 7, CLOSED))
    .addEqualityGroup(Range.closed(1, 7), Range.range(1, CLOSED, 7, CLOSED))
    .addEqualityGroup(Range.closedOpen(1, 7), Range.range(1, CLOSED, 7, OPEN))
    .testEquals();
 }
}

代码示例来源:origin: google/guava

for (BoundType boundType : BoundType.values()) {
 rangesBuilder.add(Range.upTo(i, boundType));
 rangesBuilder.add(Range.downTo(i, boundType));

代码示例来源:origin: immutables/immutables

@SuppressWarnings("unchecked")
public static <T extends Comparable<? super T>> Range<Comparable<Object>> writable(
  Encoder<T> encoder,
  Range<T> range) {
 if (range.hasLowerBound() && range.hasUpperBound()) {
  return Range.range(
    (Comparable<Object>) writable(encoder, range.lowerEndpoint()),
    range.lowerBoundType(),
    (Comparable<Object>) writable(encoder, range.upperEndpoint()),
    range.upperBoundType());
 } else if (range.hasLowerBound()) {
  return Range.downTo(
    (Comparable<Object>) writable(encoder, range.lowerEndpoint()),
    range.lowerBoundType());
 } else if (range.hasUpperBound()) {
  return Range.upTo(
    (Comparable<Object>) writable(encoder, range.upperEndpoint()),
    range.upperBoundType());
 }
 throw new AssertionError();
}

代码示例来源:origin: FasterXML/jackson-datatypes-collections

@Override
  public Range<C> call() throws Exception {
    return Range.downTo(lowerEndpoint, lowerBoundType);
  }
}, legacyDownToMethod, lowerEndpoint, lowerBoundType);

代码示例来源:origin: com.diffplug.guava/guava-collect

@Override
public NavigableMap<Cut<C>, Range<C>> tailMap(Cut<C> fromKey, boolean inclusive) {
  return subMap(Range.downTo(fromKey, BoundType.forBoolean(inclusive)));
}

相关文章