loopj/android-async-http — pull request #318 by cbliu (2013-10-03 04:41:05+00:00)
Title: Allow request params of nested map, list, and set

This change supports map, list, or set of string values as request parameters. Nested parameters, such as list of maps or map of lists, are also supported. These types of parameters are not uncommon, especially for API backed by Rails. See http://www.spacevatican.org/2008/7/18/parametrised-to-the-max/ for examples.

The parameter map in the original code, `urlParams`, can be removed as this change uses a map with `Object` values. The method `put(String, String)` can be removed as well since a new method `put(String, Object)` was added. However, I left them untouched for clarity.

I removed the method `put(String, ArrayList)` which was used for unordered array parameters. Instead, use `HashSet` as the parameter with this code change. `ArrayList` is now used for ordered array parameters.

The convenient method `add(String, String)` is still supported to append a value to the string set or the string list for a given key. If the given key does not exist, a set of strings is created for backward compatibility.

Here are a few examples showing parameter types and resulting url parameters:
* `Map`
* user: {first_name: James, last_name: Smith} => "user[first_name]=James&user[last_name]=Smith"
* `Set`
* like: {music, art} => "like=music&like=art"
* `List` or `String[]`
* languages: [Java, C] => "languages[]=Java&languages[]=C"
* `List>`
* users: [{age: 30, gender: male}, {age: 25, gender: female}] => "users[][age]=30&users[][gender]=male&users[][age]=25&users[][gender]=female"
* `Map>`
* mobile: {android: [google, samsung, htc], ios: [apple]} => "mobile[android][]=google&mobile[android][]=samsung&mobile[android][]=htc&mobile[ios][]=apple"

This commit was inspired by [AFNetworking](https://github.com/AFNetworking/AFNetworking), an iOS networking project.