Most concise way to convert a Set<T> to a List<T>

Jacques Ren&#233; Mesrine picture Jacques René Mesrine · Feb 23, 2010 · Viewed 213k times · Source

For example, I am currently doing this:

Set<String> setOfTopicAuthors = ....

List<String> list = Arrays.asList( 
    setOfTopicAuthors.toArray( new String[0] ) );

Can you beat this ?

Answer

Schildmeijer picture Schildmeijer · Feb 23, 2010
List<String> list = new ArrayList<String>(listOfTopicAuthors);