zoukankan      html  css  js  c++  java
  • Apache Commons Collections

    http://commons.apache.org/proper/commons-collections/userguide.html

    1. Utilities

    • SetUtils
    • CollectionUtils 
    • MapUtils

    2.Maps

    • Map Iteration
      •   
        IterableMap map = new HashedMap();
        MapIterator it = map.mapIterator();
        while (it.hasNext()) {
          Object key = it.next();
          Object value = it.getValue();
         
          it.setValue(newValue);
        }
    • Ordered Maps
      •   
        OrderedMap map = new LinkedMap();
        map.put("FIVE", "5");
        map.put("SIX", "6");
        map.put("SEVEN", "7");
        map.firstKey();  // returns "FIVE"
        map.nextKey("FIVE");  // returns "SIX"
        map.nextKey("SIX");  // returns "SEVEN"
    • Bidirectional Maps
      •   
        BidiMap bidi = new TreeBidiMap();
        bidi.put("SIX", "6");
        bidi.get("SIX");  // returns "6"
        bidi.getKey("6");  // returns "SIX"
        bidi.removeValue("6");  // removes the mapping
        BidiMap inverse = bidi.inverseBidiMap();  // returns a map with keys and values swapped

    3.Bags

    Bag bag = new HashBag();
    bag.add("ONE", 6);  // add 6 copies of "ONE"
    bag.remove("ONE", 2);  // removes 2 copies of "ONE"
    bag.getCount("ONE");  // returns 4, the number of copies in the bag (6 - 2)
  • 相关阅读:
    hdu 1286
    hdu 1420
    hdu 2068
    hdu 1718
    hdu 1231
    hdu 1072
    HDOJ 350留念
    hdu 1898
    hdu 1593
    帮助理解git的图
  • 原文地址:https://www.cnblogs.com/zeng200103/p/3790549.html
Copyright © 2011-2022 走看看