Whats the quickest way to put a set into a map?
public class mySet<T>
{
private Map<T, Integer> map;
public mySet(Set<T> set)
{
Object[] array = set.toArray();
for(int i =0; i< array.length; i++)
{
T v = (T)array[i];
map.put(v, 1);
}
}
}
Right now, I just converted set into an array and loop through the array and putting them in one by one. Is there any better way to do this?