2018年4月25日 星期三

0425 火曜日



0425 English Class




  1. thoughtful(adj) : carefully considering things
    ->It's thoughtful of you to take such good care of my parents.
  2. flatter(V) :  praise someone in order to make them feel attractive or important, sometimes in a way that is not sincere
  3. delicate(adj) :  needing careful treatment
  4. attentive(adj) :  listening carefully
    ->an attentive audience
  5. Sleepless : without any sleep
  6. Penniless : having no money



2018年2月9日 星期五

泛型 PECS


Producer Extends

如果你只是需要讀取

再泛型中 就使用 ? extends [ 消費者 ] 

反之,

若是寫入,則用 ?super [ 生產者 ] 


===================

extends
如果你需要一个列表提供T類型的元素(即你想從列表中“讀取”T類型的元素),你需要把這個列表聲明成<? extends T>,比如List<? extends Integer>,因此你不能往該列表中添加任何元素。

super
如果需要一个列表使用T類型的元素(即你想把T類型的元素”加入“到列表中),你需要把这个列表聲明成<? super T>,比如List<? super Integer>,因此你不能保證從中讀取到的元素的類型。