package com.vzome.core.exporters;

import java.util.Arrays;
import java.util.HashMap;

/**
 * @author David Hall
 */
public final class TwoMaps {
    private TwoMaps () {}
    
    /**
     * @param <K> The type of keys used by the maps in the array
     * @param <V> The type of mapped values
     * @param autoGeneratedArray *** Should not be provided. *** 
     * Example: Note that no parameter is passed to the method.
     * {@code HashMap<Polyhedron, Integer> [] shapes = TwoMaps.inAnArray(); }
     * Conceptually, it is similar to a type safe version of the following:
     * {@code  HashMap<K, V>[] shapes =  new HashMap[] { new HashMap<>(), new HashMap<>() }; }
     * @return a two element array populated with HashMaps of the specified type
     */
    @SafeVarargs
    @SuppressWarnings( "varargs" ) 
    public static <K, V> HashMap<K, V>[] inAnArray(HashMap<K, V>... autoGeneratedArray) {
        
        HashMap<K, V>[] result = Arrays.copyOf(autoGeneratedArray, 2);
        for(int i = 0; i< result.length; i++) {
            result[i] = new HashMap<>();
        }
        return result;
    }
}
