Java Code Examples for com.google.common.collect.SortedLists.KeyPresentBehavior

The following are top voted examples for showing how to use com.google.common.collect.SortedLists.KeyPresentBehavior. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: guava-mock   File: ImmutableRangeMap.java   View source code 6 votes vote down vote up
@Override
@Nullable
public V get(K key) {
  int index =
      SortedLists.binarySearch(
          ranges,
          Range.<K>lowerBoundFn(),
          Cut.belowValue(key),
          KeyPresentBehavior.ANY_PRESENT,
          KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? values.get(index) : null;
  }
}
 
Example 2
Project: guava-mock   File: ImmutableRangeMap.java   View source code 6 votes vote down vote up
@Override
@Nullable
public Map.Entry<Range<K>, V> getEntry(K key) {
  int index =
      SortedLists.binarySearch(
          ranges,
          Range.<K>lowerBoundFn(),
          Cut.belowValue(key),
          KeyPresentBehavior.ANY_PRESENT,
          KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? Maps.immutableEntry(range, values.get(index)) : null;
  }
}
 
Example 3
Project: googles-monorepo-demo   File: ImmutableRangeMap.java   View source code 6 votes vote down vote up
@Override
@Nullable
public V get(K key) {
  int index =
      SortedLists.binarySearch(
          ranges,
          Range.<K>lowerBoundFn(),
          Cut.belowValue(key),
          KeyPresentBehavior.ANY_PRESENT,
          KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? values.get(index) : null;
  }
}
 
Example 4
Project: googles-monorepo-demo   File: ImmutableRangeMap.java   View source code 6 votes vote down vote up
@Override
@Nullable
public Map.Entry<Range<K>, V> getEntry(K key) {
  int index =
      SortedLists.binarySearch(
          ranges,
          Range.<K>lowerBoundFn(),
          Cut.belowValue(key),
          KeyPresentBehavior.ANY_PRESENT,
          KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? Maps.immutableEntry(range, values.get(index)) : null;
  }
}
 
Example 5
Project: codebuff   File: ImmutableRangeMap.java   View source code 6 votes vote down vote up
@Override
@Nullable
public V get(K key) {
  int index =
      SortedLists.binarySearch(
          ranges,
          Range.<K>lowerBoundFn(),
          Cut.belowValue(key),
          KeyPresentBehavior.ANY_PRESENT,
          KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? values.get(index) : null;
  }
}
 
Example 6
Project: codebuff   File: ImmutableRangeMap.java   View source code 6 votes vote down vote up
@Override
@Nullable
public Map.Entry<Range<K>, V> getEntry(K key) {
  int index =
      SortedLists.binarySearch(
          ranges,
          Range.<K>lowerBoundFn(),
          Cut.belowValue(key),
          KeyPresentBehavior.ANY_PRESENT,
          KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? Maps.immutableEntry(range, values.get(index)) : null;
  }
}
 
Example 7
Project: guava   File: ImmutableRangeMap.java   View source code 6 votes vote down vote up
@Override
@NullableDecl
public V get(K key) {
  int index =
      SortedLists.binarySearch(
          ranges,
          Range.<K>lowerBoundFn(),
          Cut.belowValue(key),
          KeyPresentBehavior.ANY_PRESENT,
          KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? values.get(index) : null;
  }
}
 
Example 8
Project: guava   File: ImmutableRangeMap.java   View source code 6 votes vote down vote up
@Override
@NullableDecl
public Entry<Range<K>, V> getEntry(K key) {
  int index =
      SortedLists.binarySearch(
          ranges,
          Range.<K>lowerBoundFn(),
          Cut.belowValue(key),
          KeyPresentBehavior.ANY_PRESENT,
          KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? Maps.immutableEntry(range, values.get(index)) : null;
  }
}
 
Example 9
Project: guava   File: ImmutableRangeMap.java   View source code 6 votes vote down vote up
@Override
@NullableDecl
public V get(K key) {
  int index =
      SortedLists.binarySearch(
          ranges,
          Range.<K>lowerBoundFn(),
          Cut.belowValue(key),
          KeyPresentBehavior.ANY_PRESENT,
          KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? values.get(index) : null;
  }
}
 
Example 10
Project: guava   File: ImmutableRangeMap.java   View source code 6 votes vote down vote up
@Override
@NullableDecl
public Entry<Range<K>, V> getEntry(K key) {
  int index =
      SortedLists.binarySearch(
          ranges,
          Range.<K>lowerBoundFn(),
          Cut.belowValue(key),
          KeyPresentBehavior.ANY_PRESENT,
          KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? Maps.immutableEntry(range, values.get(index)) : null;
  }
}
 
Example 11
Project: guava-mock   File: SortedListsTest.java   View source code 5 votes vote down vote up
public void testWithoutDups() {
  for (KeyPresentBehavior presentBehavior : KeyPresentBehavior.values()) {
    for (KeyAbsentBehavior absentBehavior : KeyAbsentBehavior.values()) {
      for (int key = 0; key <= 10; key++) {
        assertModelAgrees(LIST_WITHOUT_DUPS, key,
            SortedLists.binarySearch(LIST_WITHOUT_DUPS, key, presentBehavior, absentBehavior),
            presentBehavior, absentBehavior);
      }
    }
  }
}
 
Example 12
Project: guava-mock   File: SortedListsTest.java   View source code 5 votes vote down vote up
public void testWithDups() {
  for (KeyPresentBehavior presentBehavior : KeyPresentBehavior.values()) {
    for (KeyAbsentBehavior absentBehavior : KeyAbsentBehavior.values()) {
      for (int key = 0; key <= 10; key++) {
        assertModelAgrees(LIST_WITH_DUPS, key,
            SortedLists.binarySearch(LIST_WITH_DUPS, key, presentBehavior, absentBehavior),
            presentBehavior, absentBehavior);
      }
    }
  }
}
 
Example 13
Project: googles-monorepo-demo   File: SortedListsTest.java   View source code 5 votes vote down vote up
public void testWithoutDups() {
  for (KeyPresentBehavior presentBehavior : KeyPresentBehavior.values()) {
    for (KeyAbsentBehavior absentBehavior : KeyAbsentBehavior.values()) {
      for (int key = 0; key <= 10; key++) {
        assertModelAgrees(LIST_WITHOUT_DUPS, key,
            SortedLists.binarySearch(LIST_WITHOUT_DUPS, key, presentBehavior, absentBehavior),
            presentBehavior, absentBehavior);
      }
    }
  }
}
 
Example 14
Project: googles-monorepo-demo   File: SortedListsTest.java   View source code 5 votes vote down vote up
public void testWithDups() {
  for (KeyPresentBehavior presentBehavior : KeyPresentBehavior.values()) {
    for (KeyAbsentBehavior absentBehavior : KeyAbsentBehavior.values()) {
      for (int key = 0; key <= 10; key++) {
        assertModelAgrees(LIST_WITH_DUPS, key,
            SortedLists.binarySearch(LIST_WITH_DUPS, key, presentBehavior, absentBehavior),
            presentBehavior, absentBehavior);
      }
    }
  }
}
 
Example 15
Project: codebuff   File: ImmutableRangeMap.java   View source code 5 votes vote down vote up
@Override
@Nullable
public V get(K key) {
  int index = SortedLists.binarySearch(ranges, Range.<K>lowerBoundFn(), Cut.belowValue(key), KeyPresentBehavior.ANY_PRESENT, KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? values.get(index) : null;
  }
}
 
Example 16
Project: codebuff   File: ImmutableRangeMap.java   View source code 5 votes vote down vote up
@Override
@Nullable
public Map.Entry<Range<K>, V> getEntry(K key) {
  int index = SortedLists.binarySearch(ranges, Range.<K>lowerBoundFn(), Cut.belowValue(key), KeyPresentBehavior.ANY_PRESENT, KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? Maps.immutableEntry(range, values.get(index)) : null;
  }
}
 
Example 17
Project: codebuff   File: ImmutableRangeMap.java   View source code 5 votes vote down vote up
@Override
@Nullable
public V get(K key) {
  int index = SortedLists.binarySearch(ranges, Range.<K>lowerBoundFn(), Cut.belowValue(key), KeyPresentBehavior.ANY_PRESENT, KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? values.get(index) : null;
  }
}
 
Example 18
Project: codebuff   File: ImmutableRangeMap.java   View source code 5 votes vote down vote up
@Override
@Nullable
public Map.Entry<Range<K>, V> getEntry(K key) {
  int index = SortedLists.binarySearch(ranges, Range.<K>lowerBoundFn(), Cut.belowValue(key), KeyPresentBehavior.ANY_PRESENT, KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? Maps.immutableEntry(range, values.get(index)) : null;
  }
}
 
Example 19
Project: codebuff   File: ImmutableRangeMap.java   View source code 5 votes vote down vote up
@Override
@Nullable
public V get(K key) {
  int index = SortedLists.binarySearch(ranges, Range.<K>lowerBoundFn(), Cut.belowValue(key), KeyPresentBehavior.ANY_PRESENT, KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? values.get(index) : null;
  }
}
 
Example 20
Project: codebuff   File: ImmutableRangeMap.java   View source code 5 votes vote down vote up
@Override
@Nullable
public Map.Entry<Range<K>, V> getEntry(K key) {
  int index = SortedLists.binarySearch(ranges, Range.<K>lowerBoundFn(), Cut.belowValue(key), KeyPresentBehavior.ANY_PRESENT, KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? Maps.immutableEntry(range, values.get(index)) : null;
  }
}
 
Example 21
Project: codebuff   File: ImmutableRangeMap.java   View source code 5 votes vote down vote up
@Override
@Nullable
public V get(K key) {
  int index = SortedLists.binarySearch(ranges, Range.<K>lowerBoundFn(), Cut.belowValue(key), KeyPresentBehavior.ANY_PRESENT, KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? values.get(index) : null;
  }
}
 
Example 22
Project: codebuff   File: ImmutableRangeMap.java   View source code 5 votes vote down vote up
@Override
@Nullable
public Map.Entry<Range<K>, V> getEntry(K key) {
  int index = SortedLists.binarySearch(ranges, Range.<K>lowerBoundFn(), Cut.belowValue(key), KeyPresentBehavior.ANY_PRESENT, KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? Maps.immutableEntry(range, values.get(index)) : null;
  }
}
 
Example 23
Project: bts   File: ImmutableRangeMap.java   View source code 5 votes vote down vote up
@Override
@Nullable
public V get(K key) {
  int index = SortedLists.binarySearch(ranges, Range.<K>lowerBoundFn(),
      Cut.belowValue(key), KeyPresentBehavior.ANY_PRESENT, KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? values.get(index) : null;
  }
}
 
Example 24
Project: bts   File: ImmutableRangeMap.java   View source code 5 votes vote down vote up
@Override
@Nullable
public Map.Entry<Range<K>, V> getEntry(K key) {
  int index = SortedLists.binarySearch(ranges, Range.<K>lowerBoundFn(),
      Cut.belowValue(key), KeyPresentBehavior.ANY_PRESENT, KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? Maps.immutableEntry(range, values.get(index)) : null;
  }
}
 
Example 25
Project: j2objc   File: ImmutableRangeMap.java   View source code 5 votes vote down vote up
@Override
@Nullable
public V get(K key) {
  int index = SortedLists.binarySearch(ranges, Range.<K>lowerBoundFn(),
      Cut.belowValue(key), KeyPresentBehavior.ANY_PRESENT, KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? values.get(index) : null;
  }
}
 
Example 26
Project: j2objc   File: ImmutableRangeMap.java   View source code 5 votes vote down vote up
@Override
@Nullable
public Map.Entry<Range<K>, V> getEntry(K key) {
  int index = SortedLists.binarySearch(ranges, Range.<K>lowerBoundFn(),
      Cut.belowValue(key), KeyPresentBehavior.ANY_PRESENT, KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? Maps.immutableEntry(range, values.get(index)) : null;
  }
}
 
Example 27
Project: guava-libraries   File: ImmutableRangeMap.java   View source code 5 votes vote down vote up
@Override
@Nullable
public V get(K key) {
  int index = SortedLists.binarySearch(ranges, Range.<K>lowerBoundFn(),
      Cut.belowValue(key), KeyPresentBehavior.ANY_PRESENT, KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? values.get(index) : null;
  }
}
 
Example 28
Project: guava-libraries   File: ImmutableRangeMap.java   View source code 5 votes vote down vote up
@Override
@Nullable
public Map.Entry<Range<K>, V> getEntry(K key) {
  int index = SortedLists.binarySearch(ranges, Range.<K>lowerBoundFn(),
      Cut.belowValue(key), KeyPresentBehavior.ANY_PRESENT, KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? Maps.immutableEntry(range, values.get(index)) : null;
  }
}
 
Example 29
Project: guava-libraries   File: SortedListsTest.java   View source code 5 votes vote down vote up
public void testWithoutDups() {
  for (KeyPresentBehavior presentBehavior : KeyPresentBehavior.values()) {
    for (KeyAbsentBehavior absentBehavior : KeyAbsentBehavior.values()) {
      for (int key = 0; key <= 10; key++) {
        assertModelAgrees(LIST_WITHOUT_DUPS, key,
            SortedLists.binarySearch(LIST_WITHOUT_DUPS, key, presentBehavior, absentBehavior),
            presentBehavior, absentBehavior);
      }
    }
  }
}
 
Example 30
Project: guava-libraries   File: SortedListsTest.java   View source code 5 votes vote down vote up
public void testWithDups() {
  for (KeyPresentBehavior presentBehavior : KeyPresentBehavior.values()) {
    for (KeyAbsentBehavior absentBehavior : KeyAbsentBehavior.values()) {
      for (int key = 0; key <= 10; key++) {
        assertModelAgrees(LIST_WITH_DUPS, key,
            SortedLists.binarySearch(LIST_WITH_DUPS, key, presentBehavior, absentBehavior),
            presentBehavior, absentBehavior);
      }
    }
  }
}
 
Example 31
Project: guava-libraries   File: SortedListsTest.java   View source code 5 votes vote down vote up
public void testWithoutDups() {
  for (KeyPresentBehavior presentBehavior : KeyPresentBehavior.values()) {
    for (KeyAbsentBehavior absentBehavior : KeyAbsentBehavior.values()) {
      for (int key = 0; key <= 10; key++) {
        assertModelAgrees(LIST_WITHOUT_DUPS, key,
            SortedLists.binarySearch(LIST_WITHOUT_DUPS, key, presentBehavior, absentBehavior),
            presentBehavior, absentBehavior);
      }
    }
  }
}
 
Example 32
Project: guava-libraries   File: SortedListsTest.java   View source code 5 votes vote down vote up
public void testWithDups() {
  for (KeyPresentBehavior presentBehavior : KeyPresentBehavior.values()) {
    for (KeyAbsentBehavior absentBehavior : KeyAbsentBehavior.values()) {
      for (int key = 0; key <= 10; key++) {
        assertModelAgrees(LIST_WITH_DUPS, key,
            SortedLists.binarySearch(LIST_WITH_DUPS, key, presentBehavior, absentBehavior),
            presentBehavior, absentBehavior);
      }
    }
  }
}
 
Example 33
Project: VectorAttackScanner   File: ImmutableRangeMap.java   View source code 5 votes vote down vote up
@Override
@Nullable
public V get(K key) {
  int index = SortedLists.binarySearch(ranges, Range.<K>lowerBoundFn(),
      Cut.belowValue(key), KeyPresentBehavior.ANY_PRESENT, KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? values.get(index) : null;
  }
}
 
Example 34
Project: VectorAttackScanner   File: ImmutableRangeMap.java   View source code 5 votes vote down vote up
@Override
@Nullable
public Map.Entry<Range<K>, V> getEntry(K key) {
  int index = SortedLists.binarySearch(ranges, Range.<K>lowerBoundFn(),
      Cut.belowValue(key), KeyPresentBehavior.ANY_PRESENT, KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? Maps.immutableEntry(range, values.get(index)) : null;
  }
}
 
Example 35
Project: guava   File: SortedListsTest.java   View source code 5 votes vote down vote up
public void testWithoutDups() {
  for (KeyPresentBehavior presentBehavior : KeyPresentBehavior.values()) {
    for (KeyAbsentBehavior absentBehavior : KeyAbsentBehavior.values()) {
      for (int key = 0; key <= 10; key++) {
        assertModelAgrees(
            LIST_WITHOUT_DUPS,
            key,
            SortedLists.binarySearch(LIST_WITHOUT_DUPS, key, presentBehavior, absentBehavior),
            presentBehavior,
            absentBehavior);
      }
    }
  }
}
 
Example 36
Project: guava   File: SortedListsTest.java   View source code 5 votes vote down vote up
public void testWithDups() {
  for (KeyPresentBehavior presentBehavior : KeyPresentBehavior.values()) {
    for (KeyAbsentBehavior absentBehavior : KeyAbsentBehavior.values()) {
      for (int key = 0; key <= 10; key++) {
        assertModelAgrees(
            LIST_WITH_DUPS,
            key,
            SortedLists.binarySearch(LIST_WITH_DUPS, key, presentBehavior, absentBehavior),
            presentBehavior,
            absentBehavior);
      }
    }
  }
}
 
Example 37
Project: guava   File: SortedListsTest.java   View source code 5 votes vote down vote up
public void testWithoutDups() {
  for (KeyPresentBehavior presentBehavior : KeyPresentBehavior.values()) {
    for (KeyAbsentBehavior absentBehavior : KeyAbsentBehavior.values()) {
      for (int key = 0; key <= 10; key++) {
        assertModelAgrees(
            LIST_WITHOUT_DUPS,
            key,
            SortedLists.binarySearch(LIST_WITHOUT_DUPS, key, presentBehavior, absentBehavior),
            presentBehavior,
            absentBehavior);
      }
    }
  }
}
 
Example 38
Project: guava   File: SortedListsTest.java   View source code 5 votes vote down vote up
public void testWithDups() {
  for (KeyPresentBehavior presentBehavior : KeyPresentBehavior.values()) {
    for (KeyAbsentBehavior absentBehavior : KeyAbsentBehavior.values()) {
      for (int key = 0; key <= 10; key++) {
        assertModelAgrees(
            LIST_WITH_DUPS,
            key,
            SortedLists.binarySearch(LIST_WITH_DUPS, key, presentBehavior, absentBehavior),
            presentBehavior,
            absentBehavior);
      }
    }
  }
}
 
Example 39
Project: cnGuava   File: ImmutableRangeMap.java   View source code 5 votes vote down vote up
@Override
@Nullable
public V get(K key) {
  int index = SortedLists.binarySearch(ranges, Range.<K>lowerBoundFn(),
      Cut.belowValue(key), KeyPresentBehavior.ANY_PRESENT, KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? values.get(index) : null;
  }
}
 
Example 40
Project: cnGuava   File: ImmutableRangeMap.java   View source code 5 votes vote down vote up
@Override
@Nullable
public Map.Entry<Range<K>, V> getEntry(K key) {
  int index = SortedLists.binarySearch(ranges, Range.<K>lowerBoundFn(),
      Cut.belowValue(key), KeyPresentBehavior.ANY_PRESENT, KeyAbsentBehavior.NEXT_LOWER);
  if (index == -1) {
    return null;
  } else {
    Range<K> range = ranges.get(index);
    return range.contains(key) ? Maps.immutableEntry(range, values.get(index)) : null;
  }
}