is it ok to do this... and generics
From: sparkles (user_at_site.com)
Date: 03/30/05
- Next message: IchBin: "Comments..."
- Previous message: Anton Spaans: "Re: Maybe this is the issue:"
- Next in thread: Lee Weiner: "Re: is it ok to do this... and generics"
- Reply: Lee Weiner: "Re: is it ok to do this... and generics"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 29 Mar 2005 22:06:45 GMT
sorry about the subject - i'm not quite sure what it is i'm asking is called
is there anything wrong with doing this...?
ArrayList al = new ArrayList();
al.add(new MyClass(1, 2, 3, 4)); <-----
or is it better to do this?
ArrayList al = new ArrayList();
MyClass class = MyClass(1, 2, 3, 4);
al.add(class);
also if the arraylist is instantiated using generics as such
ArrayList<MyClass> al = new ArrayList<MyClass>();
does that mean that al.get() will return a MyClass or do i still have to
cast it?
TIA
- Next message: IchBin: "Comments..."
- Previous message: Anton Spaans: "Re: Maybe this is the issue:"
- Next in thread: Lee Weiner: "Re: is it ok to do this... and generics"
- Reply: Lee Weiner: "Re: is it ok to do this... and generics"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|