Here you can find the source of setToList(Set
public static <T> List<T> setToList(Set<T> set)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; public class Main { public static <T> List<T> setToList(Set<T> set) { if (isNotEmpty(set)) { List<T> list = new ArrayList<>(); for (T t : set) { list.add(t);/*w w w. j a va2 s. c o m*/ } return list; } return Collections.emptyList(); } public static boolean isNotEmpty(Collection<? extends Object> col) { return col != null && col.size() > 0; } public static boolean isNotEmpty(Map<? extends Object, ? extends Object> map) { return map != null && map.size() > 0; } }