Example usage for org.apache.commons.collections15.keyvalue DefaultMapEntry DefaultMapEntry

List of usage examples for org.apache.commons.collections15.keyvalue DefaultMapEntry DefaultMapEntry

Introduction

In this page you can find the example usage for org.apache.commons.collections15.keyvalue DefaultMapEntry DefaultMapEntry.

Prototype

public DefaultMapEntry(final Map.Entry<K, V> entry) 

Source Link

Document

Constructs a new entry from the specified MapEntry.

Usage

From source file:de.dhke.projects.cutil.collections.aspect.AspectMapEntrySet.java

private boolean batchRemove(final Collection<?> c, final boolean retain) {
    for (Map.Entry<K, V> entry : this) {
        if (c.contains(entry) != retain) {
            CollectionItemEvent<Map.Entry<K, V>, Map<K, V>> ev = new CollectionItemEvent<Entry<K, V>, Map<K, V>>(
                    this, _aspectMap, new DefaultMapEntry<>(entry));
            _aspectMap.notifyBeforeElementRemoved(ev);
        }//from  ww w .ja  v a 2  s  .  c om
    }
    boolean wasRemoved = false;
    Iterator<Map.Entry<K, V>> iter = _entrySet.iterator();
    while (iter.hasNext()) {
        Map.Entry<K, V> entry = iter.next();
        if (c.contains(entry) != retain) {
            CollectionItemEvent<Map.Entry<K, V>, Map<K, V>> ev = new CollectionItemEvent<Entry<K, V>, Map<K, V>>(
                    this, _aspectMap, new DefaultMapEntry<>(entry));
            iter.remove();
            _aspectMap.notifyAfterElementRemoved(ev);
            wasRemoved = true;
        }
    }
    return wasRemoved;
}