Java tutorial
//package com.java2s; import java.util.HashMap; import java.util.Map; import java.util.Set; public class Main { public static Map<? extends Object, ? extends Object> transformSetToMap(Set<? extends Object> objects) { Map<Object, Object> map = new HashMap<Object, Object>(objects.size()); for (Object obj : objects) { map.put(obj, obj); } return map; } }