org.apache.commons.collections.map
Code IndexAdd Codota to your IDE (free)

Best code snippets using org.apache.commons.collections.map(Showing top 15 results out of 747)

origin: commons-collections/commons-collections

public Map makeFullMap() {
  OrderedMap m = ListOrderedMap.decorate(new HashMap());
  addSampleMappings(m);
  return UnmodifiableOrderedMap.decorate(m);
}

origin: commons-collections/commons-collections

  public Iterator iterator() {
    if (parent.delegateMap != null) {
      return parent.delegateMap.entrySet().iterator();
    }
    if (parent.size() == 0) {
      return EmptyIterator.INSTANCE;
    }
    return new EntrySetIterator(parent);
  }
}
origin: commons-collections/commons-collections

  public Iterator iterator() {
    if (parent.delegateMap != null) {
      return parent.delegateMap.keySet().iterator();
    }
    if (parent.size() == 0) {
      return EmptyIterator.INSTANCE;
    }
    return new KeySetIterator(parent);
  }
}
origin: commons-collections/commons-collections

/**
 * Creates a map which decorates the given <code>map</code> and
 * maps keys to collections of type <code>collectionClass</code>.
 *
 * @param map  the map to wrap
 * @param collectionClass  the type of the collection class
 */
public static MultiValueMap decorate(Map map, Class collectionClass) {
  return new MultiValueMap(map, new ReflectionFactory(collectionClass));
}
origin: commons-collections/commons-collections

public void testContainsValue() {
  final MultiValueMap map = createTestMap(HashSet.class);
  assertTrue(map.containsValue("uno"));
  assertTrue(map.containsValue("un"));
  assertTrue(map.containsValue("dos"));
  assertTrue(map.containsValue("deux"));
  assertTrue(map.containsValue("tres"));
  assertTrue(map.containsValue("trois"));
  assertFalse(map.containsValue("quatro"));
}
origin: commons-collections/commons-collections

public void testDecorateFactory() {
  Map map = makeFullMap();
  assertSame(map, UnmodifiableMap.decorate(map));
  
  try {
    UnmodifiableMap.decorate(null);
    fail();
  } catch (IllegalArgumentException ex) {}
}
origin: commons-collections/commons-collections

public void testKeyValue() {
  SingletonMap map = new SingletonMap(ONE, TWO);
  assertEquals(1, map.size());
  assertEquals(ONE, map.getKey());
  assertEquals(TWO, map.getValue());
  assertTrue(map instanceof KeyValue);
}
origin: commons-collections/commons-collections

public void testEquals2() {
  Flat3Map map1 = new Flat3Map();
  map1.put("a", "testA");
  map1.put("b", "testB");
  Flat3Map map2 = new Flat3Map();
  map2.put("a", "testB");
  map2.put("c", "testA");
  assertEquals(false, map1.equals(map2));
}
origin: commons-collections/commons-collections

/**
 * Gets the key at the specified index.
 * 
 * @param index  the index to retrieve
 * @return the key at the specified index
 * @throws IndexOutOfBoundsException if the index is invalid
 */
public Object get(int index) {
  return getEntry(index).getKey();
}

origin: commons-collections/commons-collections

/**
 * Gets the hashcode of the entry using temporary hard references.
 * <p>
 * This implementation uses <code>hashEntry</code> on the main map.
 * 
 * @return the hashcode of the entry
 */
public int hashCode() {
  return parent.hashEntry(getKey(), getValue());
}
origin: commons-collections/commons-collections

public void testGetCollection() {
  MultiValueMap map = new MultiValueMap();
  map.put("A", "AA");
  assertSame(map.get("A"), map.getCollection("A"));
}
 
origin: commons-collections/commons-collections

/**
 * Creates an entry set iterator.
 * Subclasses can override this to return iterators with different properties.
 * 
 * @return the entrySet iterator
 */
protected Iterator createEntrySetIterator() {
  if (size() == 0) {
    return EmptyIterator.INSTANCE;
  }
  return new EntrySetIterator(this);
}
origin: commons-collections/commons-collections

  public Iterator iterator() {
    if (parent.delegateMap != null) {
      return parent.delegateMap.values().iterator();
    }
    if (parent.size() == 0) {
      return EmptyIterator.INSTANCE;
    }
    return new ValuesIterator(parent);
  }
}
origin: commons-collections/commons-collections

/**
 * Gets the value at the specified index.
 * 
 * @param index  the index to retrieve
 * @return the key at the specified index
 * @throws IndexOutOfBoundsException if the index is invalid
 */
public Object getValue(int index) {
  return getEntry(index).getValue();
}

origin: commons-collections/commons-collections

/**
 * Gets the previous key in sequence.
 * 
 * @param key  the key to get before
 * @return the previous key
 */
public Object previousKey(Object key) {
  LinkEntry entry = (LinkEntry) getEntry(key);
  return (entry == null || entry.before == header ? null : entry.before.getKey());
}
org.apache.commons.collections.map

Most used classes

  • LRUMap
    A Map implementation with a fixed maximum size which removes the least recently used entry if an ent
  • MultiValueMap
    A MultiValueMap decorates another map, allowing it to have more than one value for a key. A MultiMap
  • HashedMap
    A Map implementation that is a general purpose alternative to HashMap. This implementation improves
  • CaseInsensitiveMap
    A case-insensitive Map. As entries are added to the map, keys are converted to all lowercase. A new
  • ListOrderedMap
    Decorates a Map to ensure that the order of addition is retained using a List to maintain order. The
  • ReferenceMap,
  • UnmodifiableMap,
  • AbstractLinkedMap$LinkEntry,
  • MultiKeyMap,
  • CompositeMap,
  • Flat3Map,
  • IdentityMap,
  • LazyMap,
  • AbstractHashedMap$HashEntry,
  • DefaultedMap,
  • FixedSizeMap,
  • FixedSizeSortedMap,
  • LazySortedMap,
  • PredicatedMap

For IntelliJ IDEA and
Android Studio

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)