[問題] Generic sorting
我需要用 Collections.sort() 去排序一個泛化的 Vector
幾經嘗試之後
prototype 變成了 Vector< ? extends Comparable< ? super Object > >
雖然我覺得有點怪怪的
這樣 Comparable 不就只能接受 Object ?
然後在 refactor 途中發現更大的問題
就是 Vector< ? extends Comparable< ? super Object > > 無法實體化
在很多地方都要大改
不知各位先進有什麼好方法來實現? 謝謝
--
自High筆記(半荒廢)
http://legnaleurc.blogspot.com/
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 112.104.125.52
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):