SCJP6
SCJP 1.6, SCWCD 5.0, SCBCD 5.0 [loading..]
Himalay Majumdar wrote:Yes..you are right.
But only List<Object>allows you to add elements.
SCJP6
SCJP 1.6, SCWCD 5.0, SCBCD 5.0 [loading..]
Robert O'Leary wrote:
Cool...and if you were using them as a method parameters, only List<? extends Object> can accept an argument other than List<Object>e.g as in Line 5
SCJP 1.6, SCWCD 5.0, SCBCD 5.0 [loading..]
All code in my posts, unless a source is explicitly mentioned, is my own.
SCJP 1.6, SCWCD 5.0, SCBCD 5.0 [loading..]
Himalay Majumdar wrote:Hi Ruben..how are you doin buddy.
Robert mentioned..List<? extends Object> can accept an argument other than List<Object>.
but List<? extends Object> can accept List<Object>
I dont see any difference between List<? super Object> and List<Object>,
but List<? super Dog> and List<Dog> are not same.
SCJP 1.6, SCWCD 1.5, MCTS, MCT
SCJP 1.6, SCWCD 5.0, SCBCD 5.0 [loading..]
Himalay Majumdar wrote:Hi Ruben..how are you doin buddy.
Robert mentioned..List<? extends Object> can accept an argument other than List<Object>.
but List<? extends Object> can accept List<Object>
I dont see any difference between List<? super Object> and List<Object>,
but List<? super Dog> and List<Dog> are not same.
All code in my posts, unless a source is explicitly mentioned, is my own.
Rex Tan wrote:
List<? super Object> is very similar to List<Object>
All code in my posts, unless a source is explicitly mentioned, is my own.
SCJP 1.6, SCWCD 5.0, SCBCD 5.0 [loading..]
Himalay Majumdar wrote:Yeah Ruben..I dint interpret his statement as whole..
. By "other than List<Object>" he means everything including List<Object>.
Now his code makes sense to me.
By the way..April 4th is my Judgement day..how about you.
All code in my posts, unless a source is explicitly mentioned, is my own.
SCJP 1.6, SCWCD 5.0, SCBCD 5.0 [loading..]
Himalay Majumdar wrote:
Robert O'Leary wrote:
Cool...and if you were using them as a method parameters, only List<? extends Object> can accept an argument other than List<Object>e.g as in Line 5
Not true.. List<? extends Object> can accept ANY argument..including..List<Object>
Check out this link for more practice
SCJP6
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|