erdemolkun / plist

Automatically exported from code.google.com/p/plist

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

GoogleCodeExporter opened this issue · comments

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

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

  • Changed state: WontFix
  • Added labels: Priority-Low, Type-Enhancement
  • Removed labels: Priority-Medium, Type-Defect
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