本文整理了Java中com.google.common.collect.Range.rangeLexOrdering
方法的一些代码示例,展示了Range.rangeLexOrdering
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Range.rangeLexOrdering
方法的具体详情如下:
包路径:com.google.common.collect.Range
类名称:Range
方法名:rangeLexOrdering
暂无
代码示例来源:origin: google/guava
@Override
public ImmutableSet<Range<C>> asRanges() {
if (ranges.isEmpty()) {
return ImmutableSet.of();
}
return new RegularImmutableSortedSet<>(ranges, Range.<C>rangeLexOrdering());
}
代码示例来源:origin: google/guava
@Override
public ImmutableMap<Range<K>, V> asMapOfRanges() {
if (ranges.isEmpty()) {
return ImmutableMap.of();
}
RegularImmutableSortedSet<Range<K>> rangeSet =
new RegularImmutableSortedSet<>(ranges, Range.<K>rangeLexOrdering());
return new ImmutableSortedMap<>(rangeSet, values);
}
代码示例来源:origin: google/guava
@Override
public ImmutableSet<Range<C>> asDescendingSetOfRanges() {
if (ranges.isEmpty()) {
return ImmutableSet.of();
}
return new RegularImmutableSortedSet<>(ranges.reverse(), Range.<C>rangeLexOrdering().reverse());
}
代码示例来源:origin: google/guava
/**
* Returns an {@code ImmutableRangeMap} containing the associations previously added to this
* builder.
*
* @throws IllegalArgumentException if any two ranges inserted into this builder overlap
*/
public ImmutableRangeMap<K, V> build() {
Collections.sort(entries, Range.<K>rangeLexOrdering().onKeys());
ImmutableList.Builder<Range<K>> rangesBuilder = new ImmutableList.Builder<>(entries.size());
ImmutableList.Builder<V> valuesBuilder = new ImmutableList.Builder<V>(entries.size());
for (int i = 0; i < entries.size(); i++) {
Range<K> range = entries.get(i).getKey();
if (i > 0) {
Range<K> prevRange = entries.get(i - 1).getKey();
if (range.isConnected(prevRange) && !range.intersection(prevRange).isEmpty()) {
throw new IllegalArgumentException(
"Overlapping ranges: range " + prevRange + " overlaps with entry " + range);
}
}
rangesBuilder.add(range);
valuesBuilder.add(entries.get(i).getValue());
}
return new ImmutableRangeMap<>(rangesBuilder.build(), valuesBuilder.build());
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public ImmutableSet<Range<C>> asRanges() {
if (ranges.isEmpty()) {
return ImmutableSet.of();
}
return new RegularImmutableSortedSet<>(ranges, Range.<C>rangeLexOrdering());
}
代码示例来源:origin: google/guava
@Override
public Iterable<Entry<Range<Integer>, String>> order(
List<Entry<Range<Integer>, String>> insertionOrder) {
return Range.<Integer>rangeLexOrdering().onKeys().sortedCopy(insertionOrder);
}
代码示例来源:origin: google/guava
@Override
public Iterable<Entry<Range<Integer>, String>> order(
List<Entry<Range<Integer>, String>> insertionOrder) {
return Range.<Integer>rangeLexOrdering().onKeys().sortedCopy(insertionOrder);
}
代码示例来源:origin: google/guava
@Override
public ImmutableMap<Range<K>, V> asDescendingMapOfRanges() {
if (ranges.isEmpty()) {
return ImmutableMap.of();
}
RegularImmutableSortedSet<Range<K>> rangeSet =
new RegularImmutableSortedSet<>(ranges.reverse(), Range.<K>rangeLexOrdering().reverse());
return new ImmutableSortedMap<>(rangeSet, values.reverse());
}
代码示例来源:origin: wildfly/wildfly
@Override
public ImmutableMap<Range<K>, V> asMapOfRanges() {
if (ranges.isEmpty()) {
return ImmutableMap.of();
}
RegularImmutableSortedSet<Range<K>> rangeSet =
new RegularImmutableSortedSet<>(ranges, Range.<K>rangeLexOrdering());
return new ImmutableSortedMap<>(rangeSet, values);
}
代码示例来源:origin: wildfly/wildfly
@Override
public ImmutableSet<Range<C>> asDescendingSetOfRanges() {
if (ranges.isEmpty()) {
return ImmutableSet.of();
}
return new RegularImmutableSortedSet<>(ranges.reverse(), Range.<C>rangeLexOrdering().reverse());
}
代码示例来源:origin: google/j2objc
/**
* Returns an {@code ImmutableRangeMap} containing the associations previously added to this
* builder.
*
* @throws IllegalArgumentException if any two ranges inserted into this builder overlap
*/
public ImmutableRangeMap<K, V> build() {
Collections.sort(entries, Range.<K>rangeLexOrdering().onKeys());
ImmutableList.Builder<Range<K>> rangesBuilder = new ImmutableList.Builder<>(entries.size());
ImmutableList.Builder<V> valuesBuilder = new ImmutableList.Builder<V>(entries.size());
for (int i = 0; i < entries.size(); i++) {
Range<K> range = entries.get(i).getKey();
if (i > 0) {
Range<K> prevRange = entries.get(i - 1).getKey();
if (range.isConnected(prevRange) && !range.intersection(prevRange).isEmpty()) {
throw new IllegalArgumentException(
"Overlapping ranges: range " + prevRange + " overlaps with entry " + range);
}
}
rangesBuilder.add(range);
valuesBuilder.add(entries.get(i).getValue());
}
return new ImmutableRangeMap<>(rangesBuilder.build(), valuesBuilder.build());
}
}
代码示例来源:origin: google/guava
@Override
public Iterable<Entry<Range<Integer>, String>> order(
List<Entry<Range<Integer>, String>> insertionOrder) {
return Range.<Integer>rangeLexOrdering()
.reverse()
.onKeys()
.sortedCopy(insertionOrder);
}
代码示例来源:origin: wildfly/wildfly
/**
* Returns an {@code ImmutableRangeMap} containing the associations previously added to this
* builder.
*
* @throws IllegalArgumentException if any two ranges inserted into this builder overlap
*/
public ImmutableRangeMap<K, V> build() {
Collections.sort(entries, Range.<K>rangeLexOrdering().onKeys());
ImmutableList.Builder<Range<K>> rangesBuilder = new ImmutableList.Builder<>(entries.size());
ImmutableList.Builder<V> valuesBuilder = new ImmutableList.Builder<V>(entries.size());
for (int i = 0; i < entries.size(); i++) {
Range<K> range = entries.get(i).getKey();
if (i > 0) {
Range<K> prevRange = entries.get(i - 1).getKey();
if (range.isConnected(prevRange) && !range.intersection(prevRange).isEmpty()) {
throw new IllegalArgumentException(
"Overlapping ranges: range " + prevRange + " overlaps with entry " + range);
}
}
rangesBuilder.add(range);
valuesBuilder.add(entries.get(i).getValue());
}
return new ImmutableRangeMap<>(rangesBuilder.build(), valuesBuilder.build());
}
}
代码示例来源:origin: google/guava
@Override
public Iterable<Entry<Range<Integer>, String>> order(
List<Entry<Range<Integer>, String>> insertionOrder) {
return Range.<Integer>rangeLexOrdering()
.reverse()
.onKeys()
.sortedCopy(insertionOrder);
}
代码示例来源:origin: wildfly/wildfly
@Override
public ImmutableMap<Range<K>, V> asDescendingMapOfRanges() {
if (ranges.isEmpty()) {
return ImmutableMap.of();
}
RegularImmutableSortedSet<Range<K>> rangeSet =
new RegularImmutableSortedSet<>(ranges.reverse(), Range.<K>rangeLexOrdering().reverse());
return new ImmutableSortedMap<>(rangeSet, values.reverse());
}
代码示例来源:origin: google/guava
ImmutableList.Builder<Range<C>> mergedRangesBuilder =
new ImmutableList.Builder<>(ranges.size());
Collections.sort(ranges, Range.<C>rangeLexOrdering());
PeekingIterator<Range<C>> peekingItr = Iterators.peekingIterator(ranges.iterator());
while (peekingItr.hasNext()) {
代码示例来源:origin: google/j2objc
ImmutableList.Builder<Range<C>> mergedRangesBuilder =
new ImmutableList.Builder<>(ranges.size());
Collections.sort(ranges, Range.<C>rangeLexOrdering());
PeekingIterator<Range<C>> peekingItr = Iterators.peekingIterator(ranges.iterator());
while (peekingItr.hasNext()) {
代码示例来源:origin: wildfly/wildfly
ImmutableList.Builder<Range<C>> mergedRangesBuilder =
new ImmutableList.Builder<>(ranges.size());
Collections.sort(ranges, Range.<C>rangeLexOrdering());
PeekingIterator<Range<C>> peekingItr = Iterators.peekingIterator(ranges.iterator());
while (peekingItr.hasNext()) {
代码示例来源:origin: google/j2objc
return ImmutableSet.of();
return new RegularImmutableSortedSet<>(ranges.reverse(), Range.<C>rangeLexOrdering().reverse());
代码示例来源:origin: com.google.guava/guava-tests
@Override
public Iterable<Entry<Range<Integer>, String>> order(
List<Entry<Range<Integer>, String>> insertionOrder) {
return Range.<Integer>rangeLexOrdering()
.reverse()
.onKeys()
.sortedCopy(insertionOrder);
}
内容来源于网络,如有侵权,请联系作者删除!