Collections

The following methods are provided for accessing maps and collections:

- {@link oaj.config.Config}
  - {@link oaj.config.Config#getObject(String,Type,Type...) getObject(String,Type,Type...)}
  - {@link oaj.config.Config#getObject(String,Parser,Type,Type...) getObject(String,Parser,Type,Type...)}
  - {@link oaj.config.Config#getObjectWithDefault(String,Object,Type,Type...) getObjectWithDefault(String,T,Type,Type...)}
  - {@link oaj.config.Config#getObjectWithDefault(String,Parser,Object,Type,Type...) getObjectWithDefault(String,T,Parser,Type,Type...)}

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:

- `getObject("...", List.class)`
  Produces: `List<?>`
- `getObject("...", LinkedList.class)`
  Produces: `LinkedList<?>`
- `getObject("...", HashSet.class, Integer.class)`
  Produces: `HashSet<Integer>`
- `getObject("...", Map.class)`
  Produces: `Map<?,?>`
- `getObject("...", HashMap.class)`
  Produces: `HashMap<?,?>`
- `getObject("...", LinkedHashMap.class, String.class, MyBean.class)`
  Produces: `LinkedHashMap<String,MyBean>`
- `getObject("...", 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 = c.getObject("addresses", ArrayList. class, Address. class);

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

ObjectMap m = c.getObject("key1", ObjectMap. class); ObjectList l = c.getObject("key2", ObjectList. class);