class Utils {

   public static <K, V> Map<K, V> unmodifiableCopy(Map<K, V> source) {
      if(source == null || source.isEmpty()) {
         return Collections.emptyMap();
      }
      if(source instanceof LinkedHashMap) { // maintain sorting
         return Collections.unmodifiableMap(new LinkedHashMap<K, V>( source ));
      }
      return Collections.unmodifiableMap(new HashMap<K, V>(source));
   }

   private  Utils();

}