Fixes issue #998.

Fixes multiple issues with the way PR #997 was implemented. 
@TShapinsky elements of the `Collection` library may have a heavy memory footprint on Android ([here's a good talk that goes into more details...](http://parleys.com/play/5298f999e4b039ad2298c9e3/chapter33/about)).

Where possible, a `Map` is better replaced by member of the [`SparseArray`](https://developer.android.com/reference/android/util/SparseArray.html) family.