Java 类com.google.common.collect.testing.SafeTreeMap 实例源码

项目:guava-mock    文件:ForwardingNavigableMapTest.java   
public void testStandardLastEntry() {
  NavigableMap<String, Integer> forwarding =
      new StandardLastEntryForwardingNavigableMap<String, Integer>(
          new SafeTreeMap<String, Integer>());
  assertNull(forwarding.lastEntry());
  forwarding.put("b", 2);
  assertEquals(immutableEntry("b", 2), forwarding.lastEntry());
  forwarding.put("c", 3);
  assertEquals(immutableEntry("c", 3), forwarding.lastEntry());
  forwarding.put("a", 1);
  assertEquals(immutableEntry("c", 3), forwarding.lastEntry());
  forwarding.remove("c");
  assertEquals(immutableEntry("b", 2), forwarding.lastEntry());
}
项目:guava-mock    文件:SynchronizedNavigableMapTest.java   
@Override protected <K, V> NavigableMap<K, V> create() {
  @SuppressWarnings("unchecked")
  NavigableMap<K, V> innermost = new SafeTreeMap<K, V>(
      (Comparator<? super K>) Ordering.natural().nullsFirst());
  TestMap<K, V> inner = new TestMap<K, V>(innermost, mutex);
  NavigableMap<K, V> outer = Synchronized.navigableMap(inner, mutex);
  return outer;
}
项目:googles-monorepo-demo    文件:ForwardingNavigableMapTest.java   
public void testStandardLastEntry() {
  NavigableMap<String, Integer> forwarding =
      new StandardLastEntryForwardingNavigableMap<String, Integer>(
          new SafeTreeMap<String, Integer>());
  assertNull(forwarding.lastEntry());
  forwarding.put("b", 2);
  assertEquals(immutableEntry("b", 2), forwarding.lastEntry());
  forwarding.put("c", 3);
  assertEquals(immutableEntry("c", 3), forwarding.lastEntry());
  forwarding.put("a", 1);
  assertEquals(immutableEntry("c", 3), forwarding.lastEntry());
  forwarding.remove("c");
  assertEquals(immutableEntry("b", 2), forwarding.lastEntry());
}
项目:googles-monorepo-demo    文件:SynchronizedNavigableMapTest.java   
@Override protected <K, V> NavigableMap<K, V> create() {
  @SuppressWarnings("unchecked")
  NavigableMap<K, V> innermost = new SafeTreeMap<K, V>(
      (Comparator<? super K>) Ordering.natural().nullsFirst());
  TestMap<K, V> inner = new TestMap<K, V>(innermost, mutex);
  NavigableMap<K, V> outer = Synchronized.navigableMap(inner, mutex);
  return outer;
}
项目:guava-libraries    文件:ForwardingNavigableMapTest.java   
public void testStandardLastEntry() {
  NavigableMap<String, Integer> forwarding =
      new StandardLastEntryForwardingNavigableMap<String, Integer>(
          new SafeTreeMap<String, Integer>());
  assertNull(forwarding.lastEntry());
  forwarding.put("b", 2);
  assertEquals(immutableEntry("b", 2), forwarding.lastEntry());
  forwarding.put("c", 3);
  assertEquals(immutableEntry("c", 3), forwarding.lastEntry());
  forwarding.put("a", 1);
  assertEquals(immutableEntry("c", 3), forwarding.lastEntry());
  forwarding.remove("c");
  assertEquals(immutableEntry("b", 2), forwarding.lastEntry());
}
项目:guava-libraries    文件:SynchronizedNavigableMapTest.java   
@Override protected <K, V> NavigableMap<K, V> create() {
  @SuppressWarnings("unchecked")
  NavigableMap<K, V> innermost = new SafeTreeMap<K, V>(
      (Comparator<? super K>) Ordering.natural().nullsFirst());
  TestMap<K, V> inner = new TestMap<K, V>(innermost, mutex);
  NavigableMap<K, V> outer = Synchronized.navigableMap(inner, mutex);
  return outer;
}
项目:guava    文件:ForwardingNavigableMapTest.java   
public void testStandardLastEntry() {
  NavigableMap<String, Integer> forwarding =
      new StandardLastEntryForwardingNavigableMap<>(new SafeTreeMap<String, Integer>());
  assertNull(forwarding.lastEntry());
  forwarding.put("b", 2);
  assertEquals(immutableEntry("b", 2), forwarding.lastEntry());
  forwarding.put("c", 3);
  assertEquals(immutableEntry("c", 3), forwarding.lastEntry());
  forwarding.put("a", 1);
  assertEquals(immutableEntry("c", 3), forwarding.lastEntry());
  forwarding.remove("c");
  assertEquals(immutableEntry("b", 2), forwarding.lastEntry());
}
项目:guava    文件:SynchronizedNavigableMapTest.java   
@Override
protected <K, V> NavigableMap<K, V> create() {
  @SuppressWarnings("unchecked")
  NavigableMap<K, V> innermost =
      new SafeTreeMap<>((Comparator<? super K>) Ordering.natural().nullsFirst());
  TestMap<K, V> inner = new TestMap<>(innermost, mutex);
  NavigableMap<K, V> outer = Synchronized.navigableMap(inner, mutex);
  return outer;
}
项目:guava    文件:ForwardingNavigableMapTest.java   
public void testStandardLastEntry() {
  NavigableMap<String, Integer> forwarding =
      new StandardLastEntryForwardingNavigableMap<>(new SafeTreeMap<String, Integer>());
  assertNull(forwarding.lastEntry());
  forwarding.put("b", 2);
  assertEquals(immutableEntry("b", 2), forwarding.lastEntry());
  forwarding.put("c", 3);
  assertEquals(immutableEntry("c", 3), forwarding.lastEntry());
  forwarding.put("a", 1);
  assertEquals(immutableEntry("c", 3), forwarding.lastEntry());
  forwarding.remove("c");
  assertEquals(immutableEntry("b", 2), forwarding.lastEntry());
}
项目:guava    文件:SynchronizedNavigableMapTest.java   
@Override
protected <K, V> NavigableMap<K, V> create() {
  @SuppressWarnings("unchecked")
  NavigableMap<K, V> innermost =
      new SafeTreeMap<>((Comparator<? super K>) Ordering.natural().nullsFirst());
  TestMap<K, V> inner = new TestMap<>(innermost, mutex);
  NavigableMap<K, V> outer = Synchronized.navigableMap(inner, mutex);
  return outer;
}