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

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

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

Range.equals介绍

[英]Returns true if object is a range having the same endpoints and bound types as this range. Note that discrete ranges such as (1..4) and [2..3] are not equal to one another, despite the fact that they each contain precisely the same set of values. Similarly, empty ranges are not equal unless they have exactly the same representation, so [3..3), (3..3], (4..4] are all unequal.
[中]如果对象是与此范围具有相同端点和绑定类型的范围,则返回true。请注意,(1..4)和[2..3]等离散范围彼此不相等,尽管它们各自包含完全相同的值集。类似地,空范围也不相等,除非它们有完全相同的表示形式,所以[3..3],(3..3],(4..4]都不相等。

代码示例

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

Object readResolve() {
 if (this.equals(ALL)) {
  return all();
 } else {
  return this;
 }
}

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

@Override
 public boolean isEmpty() {
  return upperBoundWindow.equals(Range.all())
    ? rangesByLowerBound.isEmpty()
    : !entryIterator().hasNext();
 }
}

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

Object readResolve() {
 if (this.equals(ALL)) {
  return all();
 } else {
  return this;
 }
}

代码示例来源: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: wildfly/wildfly

Object readResolve() {
 if (this.equals(ALL)) {
  return all();
 } else {
  return this;
 }
}

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

@Override
 public boolean isEmpty() {
  return upperBoundWindow.equals(Range.all())
    ? rangesByLowerBound.isEmpty()
    : !entryIterator().hasNext();
 }
}

代码示例来源:origin: google/error-prone

@Override
public boolean equals(Object o) {
 if (o == this) {
  return true;
 }
 if (o instanceof Replacement) {
  Replacement that = (Replacement) o;
  return (this.range.equals(that.range()))
     && (this.replaceWith.equals(that.replaceWith()));
 }
 return false;
}

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

@Override
public ImmutableRangeSet<C> complement() {
 ImmutableRangeSet<C> result = complement;
 if (result != null) {
  return result;
 } else if (ranges.isEmpty()) {
  return complement = all();
 } else if (ranges.size() == 1 && ranges.get(0).equals(Range.all())) {
  return complement = of();
 } else {
  ImmutableList<Range<C>> complementRanges = new ComplementRanges();
  result = complement = new ImmutableRangeSet<C>(complementRanges, this);
 }
 return result;
}

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

@Override
 public boolean isEmpty() {
  return upperBoundWindow.equals(Range.all())
    ? rangesByLowerBound.isEmpty()
    : !entryIterator().hasNext();
 }
}

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

@Override
public RangeMap<K, V> subRangeMap(Range<K> subRange) {
 if (subRange.equals(Range.all())) {
  return this;
 } else {
  return new SubRangeMap(subRange);
 }
}

代码示例来源:origin: google/google-java-format

@Override
public boolean equals(Object o) {
 if (o == this) {
  return true;
 }
 if (o instanceof Replacement) {
  Replacement that = (Replacement) o;
  return replaceRange.equals(that.getReplaceRange())
    && replacementString.equals(that.getReplacementString());
 }
 return false;
}

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

@Override
public RangeSet<C> subRangeSet(Range<C> view) {
 return view.equals(Range.<C>all()) ? this : new SubRangeSet(view);
}

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

/**
 * Returns an immutable range set containing the specified single range. If {@link Range#isEmpty()
 * range.isEmpty()}, this is equivalent to {@link ImmutableRangeSet#of()}.
 */
public static <C extends Comparable> ImmutableRangeSet<C> of(Range<C> range) {
 checkNotNull(range);
 if (range.isEmpty()) {
  return of();
 } else if (range.equals(Range.all())) {
  return all();
 } else {
  return new ImmutableRangeSet<C>(ImmutableList.of(range));
 }
}

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

@Override
public RangeMap<K, V> subRangeMap(Range<K> subRange) {
 if (subRange.equals(Range.all())) {
  return this;
 } else {
  return new SubRangeMap(subRange);
 }
}

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

@Override
public RangeSet<C> subRangeSet(Range<C> view) {
 return view.equals(Range.<C>all()) ? this : new SubRangeSet(view);
}

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

@Override
public int size() {
 if (upperBoundWindow.equals(Range.all())) {
  return rangesByLowerBound.size();
 }
 return Iterators.size(entryIterator());
}

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

return of();
} else if (mergedRanges.size() == 1
  && Iterables.getOnlyElement(mergedRanges).equals(Range.all())) {
 return all();
} else {

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

@Override
public int size() {
 if (upperBoundWindow.equals(Range.all())) {
  return rangesByLowerBound.size();
 }
 return Iterators.size(entryIterator());
}

相关文章