Changes between Version 2 and Version 3 of Generic


Ignore:
Timestamp:
Jul 10, 2008, 4:31:22 PM (16 years ago)
Author:
waue
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Generic

    v2 v3  
     1[[PageLayout]]
    12當您定義類別時,發現到好幾個類別的邏輯其實都相同,就只是當中所涉及的型態不一樣時,使用複製、貼上、取代的功能來撰寫程式只是讓您增加不必要的檔案管理困擾。
    23
     
    419420[[BR]]
    420421
    421 事實上,GenericFoo<?> immutableFoo相當於GenericFoo immutableFoo。[[BR]]
     422事實上,!GenericFoo<?> immutableFoo相當於!GenericFoo immutableFoo。[[BR]]
    422423[[BR]]
    423424
     
    427428[[BR]]
    428429
    429 '''GenericFoo<? super !StringBuilder> foo;'''[[BR]]
     430'''!GenericFoo<? super !StringBuilder> foo;'''[[BR]]
    430431
    431432 
     
    435436您可以擴充一個泛型類別,保留其型態持有者,並新增自己的型態持有者,例如先寫一個父類別:
    436437
    437     * GenericFoo.java
     438    * !GenericFoo.java
    438439{{{
    439440#!java
     
    496497實作時如下,保留所有的型態持有者:
    497498
    498     * GenericFoo.java
     499    * !GenericFoo.java
    499500{{{
    500501#!java