Re: generics fun
Re: generics fun
- Subject: Re: generics fun
- From: "Shkutkov Michael" <email@hidden>
- Date: Tue, 22 Jul 2008 02:03:34 +0400
On Tue, Jul 22, 2008 at 1:13 AM, Lachlan Deck <
email@hidden> wrote:
Hi there,
one of the things that frustrates me about generics is working with collections. So I have a framework which has some stuff that deals with the abstract entity types (with these entity types being subclassed in the relevant application).
This leads to stupid stuff like this:
public class Thing {
public void addAll( NSArray<AbstractType> foo );
...
}
And in the application:
NSArray<ConcreteType> bar;// assume exists
thing.addAll( bar ); // -- complains to be not compatible and casting fails
I can change addAll to take <? extends AbstractType> but then other stuff fails and so on. How are others dealing with this stuff?
It seems that using bounded wildcard (<? extends AbstractType>) is right solution. What sort of problem do you have with this code?
with regards,
--
Lachlan Deck
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Cheers, Michael
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >generics fun (From: Lachlan Deck <email@hidden>) |