{title:'Java Collection Framework Objects', updated:'9.0.0'}

Entries can also be read as Java Collection Framework objects. The Type,Type... arguments allow you to specify the component types for maps and collections. List class arguments can be followed by zero or one arguments representing the entry types. Map class arguments can be followed by zero or two arguments representing the key and value types. The arguments can be chained to produce any data structure consisting of maps, collections, or POJOs.

Examples are shown below:

- to(List. class)
  Produces: List<?>
- to(LinkedList. class)
  Produces: LinkedList<?>
- to(HashSet. class, Integer. class)
  Produces: HashSet<Integer>
- to(Map. class)
  Produces: Map<?,?>
- to(HashMap. class)
  Produces: HashMap<?,?>
- to(LinkedHashMap. class, String. class, MyBean. class)
  Produces: LinkedHashMap<String,MyBean>
- to(HashMap. class, Integer. class, ArrayList. class, MyBean[].class)
  Produces: LinkedHashMap<Integer,ArrayList<MyBean[]>>

##### Example:

| addresses = | [ | { | street: '123 Main Street', | city: 'Anywhere', | state: 'NY', | zip: 12345 | }, | { | street: '456 Main Street', | city: 'Anywhere', | state: 'NY', | zip: 12345 | } | ]

| List<Address> addresses = config.get("addresses").as(ArrayList. class, Address. class).orElse(null);

Oftentimes, it might be useful to parse into the {@link oaj.collections.JsonList} and {@link oaj.collections.JsonMap} classes that provide the various convenience methods for working with JSON-like data structures:

| JsonMap map = config.get("key1").asMap().orElse(null); | JsonList list = config.get("key2").asList().orElse(null);