當前位置: 首頁>>代碼示例>>Java>>正文


Java NavigableMap.remove方法代碼示例

本文整理匯總了Java中java.util.NavigableMap.remove方法的典型用法代碼示例。如果您正苦於以下問題:Java NavigableMap.remove方法的具體用法?Java NavigableMap.remove怎麽用?Java NavigableMap.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.NavigableMap的用法示例。


在下文中一共展示了NavigableMap.remove方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: decrementBitmapOfSize

import java.util.NavigableMap; //導入方法依賴的package包/類
private void decrementBitmapOfSize(Integer size, Bitmap removed) {
  Bitmap.Config config = removed.getConfig();
  NavigableMap<Integer, Integer> sizes = getSizesForConfig(config);
  Integer current = sizes.get(size);
  if (current == null) {
    throw new NullPointerException("Tried to decrement empty size"
        + ", size: " + size
        + ", removed: " + logBitmap(removed)
        + ", this: " + this);
  }

  if (current == 1) {
    sizes.remove(size);
  } else {
    sizes.put(size, current - 1);
  }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:18,代碼來源:SizeConfigStrategy.java

示例2: testPollLastEntry

import java.util.NavigableMap; //導入方法依賴的package包/類
/**
 * pollLastEntry returns entries in order
 */
public void testPollLastEntry() {
    NavigableMap map = map5();
    Map.Entry e = map.pollLastEntry();
    assertEquals(five, e.getKey());
    assertEquals("E", e.getValue());
    e = map.pollLastEntry();
    assertEquals(four, e.getKey());
    map.put(five, "E");
    e = map.pollLastEntry();
    assertEquals(five, e.getKey());
    assertEquals("E", e.getValue());
    e = map.pollLastEntry();
    assertEquals(three, e.getKey());
    map.remove(two);
    e = map.pollLastEntry();
    assertEquals(one, e.getKey());
    try {
        e.setValue("E");
        shouldThrow();
    } catch (UnsupportedOperationException success) {}
    e = map.pollLastEntry();
    assertNull(e);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:27,代碼來源:TreeSubMapTest.java

示例3: testDescendingPollFirstEntry

import java.util.NavigableMap; //導入方法依賴的package包/類
/**
 * pollFirstEntry returns entries in order
 */
public void testDescendingPollFirstEntry() {
    NavigableMap map = dmap5();
    Map.Entry e = map.pollFirstEntry();
    assertEquals(m1, e.getKey());
    assertEquals("A", e.getValue());
    e = map.pollFirstEntry();
    assertEquals(m2, e.getKey());
    map.put(m1, "A");
    e = map.pollFirstEntry();
    assertEquals(m1, e.getKey());
    assertEquals("A", e.getValue());
    e = map.pollFirstEntry();
    assertEquals(m3, e.getKey());
    map.remove(m4);
    e = map.pollFirstEntry();
    assertEquals(m5, e.getKey());
    try {
        e.setValue("A");
        shouldThrow();
    } catch (UnsupportedOperationException success) {}
    e = map.pollFirstEntry();
    assertNull(e);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:27,代碼來源:TreeSubMapTest.java

示例4: testDescendingPollLastEntry

import java.util.NavigableMap; //導入方法依賴的package包/類
/**
 * pollLastEntry returns entries in order
 */
public void testDescendingPollLastEntry() {
    NavigableMap map = dmap5();
    Map.Entry e = map.pollLastEntry();
    assertEquals(m5, e.getKey());
    assertEquals("E", e.getValue());
    e = map.pollLastEntry();
    assertEquals(m4, e.getKey());
    map.put(m5, "E");
    e = map.pollLastEntry();
    assertEquals(m5, e.getKey());
    assertEquals("E", e.getValue());
    e = map.pollLastEntry();
    assertEquals(m3, e.getKey());
    map.remove(m2);
    e = map.pollLastEntry();
    assertEquals(m1, e.getKey());
    try {
        e.setValue("E");
        shouldThrow();
    } catch (UnsupportedOperationException success) {}
    e = map.pollLastEntry();
    assertNull(e);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:27,代碼來源:TreeSubMapTest.java

示例5: decrementArrayOfSize

import java.util.NavigableMap; //導入方法依賴的package包/類
private void decrementArrayOfSize(int size, Class<?> arrayClass) {
  NavigableMap<Integer, Integer> sizes = getSizesForAdapter(arrayClass);
  Integer current = sizes.get(size);
  if (current == null) {
    throw new NullPointerException(
        "Tried to decrement empty size" + ", size: " + size + ", this: " + this);
  }
  if (current == 1) {
    sizes.remove(size);
  } else {
    sizes.put(size, current - 1);
  }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:14,代碼來源:LruArrayPool.java

示例6: testStandardLastEntry

import java.util.NavigableMap; //導入方法依賴的package包/類
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());
}
 
開發者ID:zugzug90,項目名稱:guava-mock,代碼行數:15,代碼來源:ForwardingNavigableMapTest.java

示例7: testRemove

import java.util.NavigableMap; //導入方法依賴的package包/類
/**
 * remove removes the correct key-value pair from the map
 */
public void testRemove() {
    NavigableMap map = map5();
    map.remove(five);
    assertEquals(4, map.size());
    assertFalse(map.containsKey(five));
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:10,代碼來源:TreeSubMapTest.java

示例8: testPollFirstEntry

import java.util.NavigableMap; //導入方法依賴的package包/類
/**
 * pollFirstEntry returns entries in order
 */
public void testPollFirstEntry() {
    NavigableMap map = map5();
    Map.Entry e = map.pollFirstEntry();
    assertEquals(one, e.getKey());
    assertEquals("A", e.getValue());
    e = map.pollFirstEntry();
    assertEquals(two, e.getKey());
    map.put(one, "A");
    e = map.pollFirstEntry();
    assertEquals(one, e.getKey());
    assertEquals("A", e.getValue());
    e = map.pollFirstEntry();
    assertEquals(three, e.getKey());
    map.remove(four);
    e = map.pollFirstEntry();
    assertEquals(five, e.getKey());
    try {
        e.setValue("A");
        shouldThrow();
    } catch (UnsupportedOperationException success) {}
    assertTrue(map.isEmpty());
    Map.Entry f = map.firstEntry();
    assertNull(f);
    e = map.pollFirstEntry();
    assertNull(e);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:30,代碼來源:TreeSubMapTest.java

示例9: testRemove1_NullPointerException

import java.util.NavigableMap; //導入方法依賴的package包/類
/**
 * remove(null) throws NPE
 */
public void testRemove1_NullPointerException() {
    NavigableMap c = map5();
    try {
        c.remove(null);
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:11,代碼來源:TreeSubMapTest.java

示例10: testDescendingRemove

import java.util.NavigableMap; //導入方法依賴的package包/類
/**
 * remove removes the correct key-value pair from the map
 */
public void testDescendingRemove() {
    NavigableMap map = dmap5();
    map.remove(m5);
    assertEquals(4, map.size());
    assertFalse(map.containsKey(m5));
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:10,代碼來源:TreeSubMapTest.java

示例11: remove

import java.util.NavigableMap; //導入方法依賴的package包/類
void remove(NavigableMap<Integer, Integer> map, int key) {
    if (map.remove(key) != null)
        bs.clear(key);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:5,代碼來源:ConcurrentSkipListMapTest.java


注:本文中的java.util.NavigableMap.remove方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。