Should we use Generic Collection to improve safety and performance?

前端 未结 3 1695
滥情空心
滥情空心 2021-01-24 07:11

Should we use Generic Collection to improve safety and performance?

3条回答
  •  Happy的楠姐
    2021-01-24 07:30

    Short answer: yes

    Longer answer: There are really no downsides to using generic collections. Compile-time type checking eliminates the posibility of runtime errors from casting. Performance will be greater for built-in types such as integers, since boxing and unboxing are not needed (in contrast to Java generic collections, by the way)

提交回复
热议问题