diff --git a/src/main/java/org/javimmutable/collections/common/ArrayHelper.java b/src/main/java/org/javimmutable/collections/common/ArrayHelper.java index e902ba34..7909e831 100644 --- a/src/main/java/org/javimmutable/collections/common/ArrayHelper.java +++ b/src/main/java/org/javimmutable/collections/common/ArrayHelper.java @@ -271,7 +271,7 @@ public static T[] assignDelete(@Nonnull Allocator allocator, } /** - * Returns a copy of orig containing of length limit containing all values from [0,limit). + * Returns a copy of orig of length limit containing all values from [0,limit). */ @Nonnull public static T[] prefix(@Nonnull Allocator allocator, diff --git a/src/main/java/org/javimmutable/collections/list/MultiValueNode.java b/src/main/java/org/javimmutable/collections/list/MultiValueNode.java index 61cb4426..3b6c1eb4 100644 --- a/src/main/java/org/javimmutable/collections/list/MultiValueNode.java +++ b/src/main/java/org/javimmutable/collections/list/MultiValueNode.java @@ -91,8 +91,7 @@ private MultiValueNode(T[] values) { assert count > 1; assert count <= MAX_SIZE; - this.values = allocate(count); - System.arraycopy(values, 0, this.values, 0, count); + this.values = ArrayHelper.prefix(this, values, count); } /**