Use array cloning rather than creating a new one and copying into it.
(It may be the same thing under the hood, but our pal Occam would approve.) git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3958 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -377,8 +377,7 @@ public class DSet
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
DSet nset = (DSet)super.clone();
|
DSet nset = (DSet)super.clone();
|
||||||
nset._entries = new Entry[_entries.length];
|
nset._entries = (Entry[])_entries.clone();
|
||||||
System.arraycopy(_entries, 0, nset._entries, 0, _entries.length);
|
|
||||||
nset._modCount = 0;
|
nset._modCount = 0;
|
||||||
return nset;
|
return nset;
|
||||||
} catch (CloneNotSupportedException cnse) {
|
} catch (CloneNotSupportedException cnse) {
|
||||||
|
|||||||
@@ -740,8 +740,7 @@ public class DropBoard extends Board
|
|||||||
public Object clone ()
|
public Object clone ()
|
||||||
{
|
{
|
||||||
DropBoard board = (DropBoard)super.clone();
|
DropBoard board = (DropBoard)super.clone();
|
||||||
board._board = new int[_board.length];
|
board._board = (int[])_board.clone();
|
||||||
System.arraycopy(_board, 0, board._board, 0, _board.length);
|
|
||||||
return board;
|
return board;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user