public static <V> Map<V, V> convertListToMap(List<V> list) {
        Map<V, V> map = new HashMap<V, V>();
        if(list.size() % 2 != 0)
            throw new VoldemortException("Failed to convert list to map.");
        for(int i = 0; i < list.size(); i += 2) {
            map.put(list.get(i), list.get(i + 1));
        }
        return map;
    }
public static < V > Map < V , V > convertListToMap ( List < V > list ) { Map < V , V > map = new HashMap < V , V > ( ) ; if ( list . size ( ) % 2 != 0 ) throw new VoldemortException ( "Failed to convert list to map." ) ; for ( int i = 0 ; i < list . size ( ) ; i += 2 ) { map . put ( list . get ( i ) , list . get ( i + 1 ) ) ; } return map ; }
Utility function that converts a list to a map.

@param list The list in which even elements are keys and odd elements are
values.
@rturn The map container that maps even elements to odd elements, e.g.
0->1, 2->3, etc.