Example usage for org.apache.commons.collections.bidimap DualHashBidiMap keySet

List of usage examples for org.apache.commons.collections.bidimap DualHashBidiMap keySet

Introduction

In this page you can find the example usage for org.apache.commons.collections.bidimap DualHashBidiMap keySet.

Prototype

public Set keySet() 

Source Link

Document

Gets a keySet view of the map.

Usage

From source file:eu.scape_project.archiventory.identifiers.Identification.java

/**
 * File list identification. Processing a bi-directional map of records
 * where each record has one temporary file and each temporary file has one
 * record key (strict 1:1 relationship).
 *
 * @param fileRecidBidiMap Input { "recordkey" <-> "tempfilename" }
 * @return Output { "recordkey": [ "tool/property/value" ] }
 * @throws IOException/* w w  w .ja v a2s.  c  o  m*/
 */
public HashMap<String, List<String>> identifyFileList(DualHashBidiMap fileRecidBidiMap) throws IOException {
    HashMap<String, List<String>> resultMap = new HashMap<String, List<String>>();
    Iterator iter = fileRecidBidiMap.keySet().iterator();
    while (iter.hasNext()) {
        String recordKey = (String) iter.next();
        String tmpFileName = (String) fileRecidBidiMap.get(recordKey);
        File file = new File(tmpFileName);
        HashMap idRes = this.identify(file);
        String containerFileName = recordKey.substring(0, recordKey.indexOf("/"));
        String containerIdentifier = recordKey.substring(recordKey.indexOf("/") + 1);
        String outputKey = String.format(outputKeyFormat, containerFileName, containerIdentifier);
        List<String> valueLineList = new ArrayList<String>();
        for (Object k : idRes.keySet()) {
            String property = (String) k;
            String value = (String) idRes.get(k);
            String outputValue = String.format(outputValueFormat, tool, property, value);
            valueLineList.add(outputValue);

        }
        resultMap.put(outputKey, valueLineList);
    }
    return resultMap;
}