Name: stC104175 Date: 06/30/2000
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
I request a small feature list enhancement to the abstract List interface of
the Collection Framework.
The problem occurs when one whishes to clone a list through the abstract List
interface.
This is impossible because the List interface doesn't extend Cloneable nor
redefine the clone method public:
List l= new LinkedList();
List l2= (List ) l.clone();
produce an error "method clone is protected in Object".
The only way I have found so far is to go to the actual implementation:
List l2= (List ) ((LinkedList ) l).clone();
This is not only ugly, but also is in a sense against the Collection framework
objectives.
A better alternative would be that List extends Cloneable or "publicize" the
clone method.
Thank you for your attention.
(Review ID: 106736)
======================================================================