Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Convert single object to List (See related posts)

Works with varargs in Java 1.6

   1  
   2  List<String> list = java.util.Arrays.asList("foo");

Comments on this post

spoon posts on Feb 02, 2008 at 17:59
or
   1  List<String> list = java.util.Collections.singletonList("foo");

You need to create an account or log in to post comments to this site.


Click here to browse all 5551 code snippets

Related Posts