Example usage for org.apache.commons.collections.list GrowthList GrowthList

List of usage examples for org.apache.commons.collections.list GrowthList GrowthList

Introduction

In this page you can find the example usage for org.apache.commons.collections.list GrowthList GrowthList.

Prototype

protected GrowthList(List list) 

Source Link

Document

Constructor that wraps (not copies).

Usage

From source file:org.talend.designer.components.lookup.memory.AdvancedMemoryLookup.java

/**
 * //from  w w w.  ja  v a  2  s . co  m
 * <code>AdvancedLookup</code> can be configured to store values in different modes.
 * 
 * @param useHashKeys use <code>equals()</code> and <code>hashCode()</code> methods by storing objects in hash maps
 * @param matchingMode to optimize storing and searching, and to specify which matching mode should used
 * @param uniqueMatch keep in the lookup only the last put object, but store the current number of same values for
 * each key
 * @param keepAllValues keep all identical values (with same key values) in each list of each key
 * @param countValuesForEachKey force internal count of values
 */
public AdvancedMemoryLookup(MATCHING_MODE matchingMode, boolean keepAllValues, boolean countValuesForEachKey) {
    super();
    this.keepAllValues = keepAllValues;
    this.matchingMode = matchingMode == null ? MATCHING_MODE.UNIQUE_MATCH : matchingMode;
    this.countValuesForEachKey = countValuesForEachKey; // || this.matchingMode == MATCHING_MODE.UNIQUE_MATCH;
    if (matchingMode != MATCHING_MODE.ALL_ROWS) {
        if (matchingMode == MATCHING_MODE.UNIQUE_MATCH && !keepAllValues) {
            uniqueHash = new HashMap<V, V>();
        }
        if (this.countValuesForEachKey) {
            counterHash = new HashMap<V, Integer>();
        }
        mapOfCol = new MultiLazyValuesMap(new HashMap()) {

            @Override
            public Collection instanciateNewCollection() {
                return new GrowthList(3);
            }

        };
    }
}