Campbell Ritchie wrote:I thought put() runs in amortised constant time.
A nonzero initial value is used in step 1, so the hash value will be affected by initial fields whose hash value, as computed in step 2.a, is zero. If zero was used as the initial value in step 1, the overall hash value would be unaffected by any such initial fields, which could increase collisions. The value 17 is arbitrary
Paul Clapham wrote:
I don't believe the compiler will look through your class hierarchy
Henry Wong wrote:
Can someone with deep knowledge of generics explain this one? First, it is using the diamond operator. This means that the type of the generics (that is being instantiated) is inferred. However, it is also using the wildcard. So, what is the type of the generic? How is it inferred? I have seen code like this before, and this always bothered me....![]()
the 'So the compiler cannot guarantee that '? extends Building' is correct, and therefore it won't compile.
incompatible types: List<CAP#1> cannot be converted to List<? extends Building>
where CAP#1 is a fresh type-variable: CAP#1 extends Object super: Residential from
capture of ? super Residential