Was already Clonable; made a public clone(), made it do the right thing.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@1105 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
ray
2003-04-30 22:24:31 +00:00
parent bd9ac0902b
commit 9784947f9c
@@ -1,5 +1,5 @@
//
// $Id: SortableArrayList.java,v 1.12 2003/03/30 02:26:14 mdb Exp $
// $Id: SortableArrayList.java,v 1.13 2003/04/30 22:24:31 ray Exp $
//
// samskivert library - useful routines for java programs
// Copyright (C) 2001 Michael Bayne
@@ -245,6 +245,23 @@ public class SortableArrayList extends AbstractList
// {
// }
// documentation inherited
public Object clone ()
{
try {
Object[] elDup = new Object[_elements.length];
System.arraycopy(_elements, 0, elDup, 0, _elements.length);
SortableArrayList dup = (SortableArrayList) super.clone();
dup._elements = elDup;
return dup;
} catch (CloneNotSupportedException cnse) {
com.samskivert.Log.logStackTrace(cnse); // won't happen.
return null;
}
}
/** The array of elements in our list. */
protected Object[] _elements;