package aima.core.util; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; /** * @author Ravi Mohan * @author Mike Stampone */ public class Converter { /** * Converts a Set into a List * * @param set * a collection of unique objects * * @return a new list containing the elements of the specified set, in the * order they are returned by the set's iterator. */ public List setToList(Set set) { List retVal = new ArrayList(set); return retVal; } /** * Converts a List into a Set * * @param l * a list of objects, possibly containing duplicates * @return a new set containing the unique elements of the specified list. */ public Set listToSet(List l) { Set retVal = new HashSet(l); return retVal; } }