Here you can find the source of toReverseIndex( Map
Parameter | Description |
---|---|
forwardIndex | a parameter |
public static Map<String, Map<Integer, String>> toReverseIndex( Map<String, Map<String, Integer>> forwardIndex)
//package com.java2s; //License from project: Apache License import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; public class Main { /**/*from w ww . ja v a 2s .c o m*/ * * @param forwardIndex * @return */ public static Map<String, Map<Integer, String>> toReverseIndex( Map<String, Map<String, Integer>> forwardIndex) { Map<String, Map<Integer, String>> reverseForwardIndex = new HashMap<String, Map<Integer, String>>(); for (String dimensionName : forwardIndex.keySet()) { Map<String, Integer> map = forwardIndex.get(dimensionName); reverseForwardIndex.put(dimensionName, new HashMap<Integer, String>()); for (Entry<String, Integer> entry : map.entrySet()) { reverseForwardIndex.get(dimensionName).put( entry.getValue(), entry.getKey()); } } return reverseForwardIndex; } }