Re: Educate me on generics please...
Re: Educate me on generics please...
- Subject: Re: Educate me on generics please...
- From: Ian Joyner <email@hidden>
- Date: Thu, 7 Feb 2008 10:46:08 +1100
On 07/02/2008, at 9:20 AM, James Cicenia wrote:
Hmmm,
And to think I learned that method of qualifier creation from either
a book or Apples own docs years ago.
But mixing the objects in the List was confusing me, which is what
Johann said about just using <Object>
That's probably why Java recommends using Interfaces as your generic
types – interfaces have multiple inheritance (generics really need
real multiple inheritance, not this weak interface stuff). You use the
type as the generic that has the common routines that you need to
process all the objects in the collection.
In the key/value example there is really nothing in common between the
key (a string) and the value (an arbitrary object). But you would
probably be better off using a dictionary <k, v>, but I guess that is
not the way EOF is designed, so hence generics are not very useful in
this example.
Ian
-j-
On Feb 6, 2008, at 3:52 PM, Mr. Pierre Frisch wrote:
I completely disagree on this one. Your example is bad as it mixes
different type of objects in the List. The point of generics is to
catch type cast exception at compile time instead of run time. if
you mix objects in the same array then it has no value but this is
bad style anyway.
Pierre
--
Pierre Frisch
email@hidden
On Feb 6, 2008, at 12:37, Chuck Hill wrote:
On Feb 6, 2008, at 12:33 PM, James Cicenia wrote:
Well I have decided to to start going to 1.5 now.
this is something I do all the time:
NSMutableArray args2 = new NSMutableArray();
args2.addObject("portfolio");
args2.addObject(portfolio);
myQualifier2 = EOQualifier.qualifierWithQualifierFormat("%@ =
%@", args2);
NSArray results =
EOQualifier
.filteredArrayWithQualifier(portfolioUserGroups(),myQualifier2);
How do I make that "generic Java 1.5" friendly?
From Art:
http://weblogs.java.net/blog/arnold/archive/2005/06/generics_consid_1.html
http://www.mindview.net/WebLog/log-0050
YMMV :-)
Chuck
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve
specific problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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
_______________________________________________
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
_______________________________________________
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