Skip to content

Commit 1de4235

Browse files
committed
Merge pull request processing-js#41 from Pomax/t1917
fixed ArrayList constructor call with meaningless "initial capacity"
2 parents cfa5374 + bf79a0f commit 1de4235

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

processing.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -470,15 +470,10 @@
470470
}
471471

472472
function ArrayList(a) {
473-
var array;
473+
var array = [];
474474

475475
if (a && a.toArray) {
476476
array = a.toArray();
477-
} else {
478-
array = [];
479-
if (typeof a === "number") {
480-
array.length = a > 0 ? a : 0;
481-
}
482477
}
483478

484479
/**

test/unit/arrayList.pde

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ ArrayList list2 = new ArrayList(list1);
2323
_checkEqual(list1, list2);
2424

2525
ArrayList list3 = new ArrayList(5);
26-
_checkEqual(list3.size(), 5);
26+
_checkEqual(list3.size(), 0);

0 commit comments

Comments
 (0)