meyers8686 / plist

Automatically exported from code.google.com/p/plist
0 stars 0 forks source link

Better generic support in NSArray in order to have typed arrays of NSDictionary, NSNumber, etc #45

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,
Thanks for the excellent and very helpful lib.

I found painful to cast each element when iterating elements of an NSArray that 
were childs of NSObject elements(NSDictionary, NSNumber).

I wanted to write something like this: List<NSDictionary> list = 
((NSArray<NSDictionary>) dictionary.objectForKey(key)).getArray();

Here's a fork that allow it (switch from java array to collections and add 
generic type NSArray<T>)
https://github.com/lukaspili/Plist-Java-Android-Library

Cheers,
Lukas

Original issue reported on code.google.com by lukasz.p...@gmail.com on 8 Dec 2013 at 8:17

GoogleCodeExporter commented 9 years ago
Although this could be nice to have it would break support for code where 
values are changed by directly accessing the underlying array via 
NSArray.getArray(). Generic implementation of the NSArray class without 
changing the underlying data structure to another generic one (like a 
collection, as you did) is not possible without breaking the aforementioned 
functionality. If people need a generic NSArray they can then use your fork, 
thanks for your work.

Original comment by daniel.dreibrodt on 12 Feb 2014 at 1:06

GoogleCodeExporter commented 9 years ago
Yeah that's true, I didn't think about that.
Thanks for the response and the great library again.

Lukasz

Original comment by lukasz.p...@gmail.com on 12 Feb 2014 at 1:08