DZone 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

Snippets has posted 5883 posts at DZone. View Full User Profile

Convert Single Object To List

10.12.2006
| 25292 views |
  • submit to reddit
        Works with varargs in Java 1.6

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

Comments

replied on Sat, 2008/02/02 - 6:34pm

or List list = java.util.Collections.singletonList("foo");