Example usage for org.apache.commons.collections SequencedHashMap getFirst

List of usage examples for org.apache.commons.collections SequencedHashMap getFirst

Introduction

In this page you can find the example usage for org.apache.commons.collections SequencedHashMap getFirst.

Prototype

public Map.Entry getFirst() 

Source Link

Document

Return the entry for the "oldest" mapping.

Usage

From source file:org.openlaszlo.cache.Cache.java

/**
 * Clear entries from given map//  www  .  j a va 2  s  . c  o  m
 * @param map to clear
 */
private boolean clearMap(SequencedHashMap map) {

    boolean ok = true;
    while (map.size() > 0) {
        Map.Entry<?, ?> first = map.getFirst();
        Object key = first.getKey();
        Item item = (Item) first.getValue();
        item.lock();
        if (!item.removeAndUnlock()) {
            ok = false;
        }
        map.remove(key);
    }

    return ok;
}