On 23/07/2008, at 2:43 AM, Mike Schrag wrote:

This is worth watching if you are wanting to learn more about using generics (and enums):

http://www.youtube.com/watch?v=pi_I7oD_uGI
That's a great video ...

So I have a method which returns a batch of raw records like so:
(a) public Map< String, NSArray< NSDictionary< String, Object >> > nextBatch();

and elsewhere I've got a method like so (according to PECS)
(b) public NSArray<Foo> faultRecordsForRawRows(String entityName, NSArray<NSDictionary<String,? extends Object>>);

Guess what: the results of 'a' cannot be passed to 'b'.

// so we end up having to drop the typing like so:
for ( String entityName : currentRawBatch.keySet() )
{
// Note the following works but doing NSArray<NSDictionary<String,?>> doesn't.
        NSArray< ? > rawRecords = currentRawBatch.get( entityName );
        <..>
        // and then do a cast for which I have to suppress warnings
NSArray<Foo> foos = controller.faultRecordsForRawRows( ( NSArray< NSDictionary< String, ? extends Object >> )rawRecords, entityName );
        ...
}

So that's a bit annoying. As I understand it it's not the done thing to have return values that 'extend' something. So is there any other suggestions?

with regards,
--

Lachlan Deck

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to