Skip to content

ImmutableIntList of four does not store 2nd and 3rd element correctly. #681

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public interface ImmutableIntList {
Checks.notNull(others, "Int array");
final int[] array = new int[3 + others.length];
array[0] = i1;
array[0] = i2;
array[0] = i3;
array[1] = i2;
array[2] = i3;
System.arraycopy(others, 0, array, 3, others.length);
return new ImmutableIntArray(array);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ void of_single() {
assertSame(ImmutableIntElement.class, built1.getClass());
}

@Test
void of_four() {
final ImmutableIntList of4 = ImmutableIntList.of(1, 2, 3, 4);
assertEquals(1, of4.get(0));
assertEquals(2, of4.get(1));
assertEquals(3, of4.get(2));
assertEquals(4, of4.get(3));
}

@Test
void of_multiple() {
final ImmutableIntList of1 = ImmutableIntList.of(1, 2);
Expand Down