Skip to content

Instantly share code, notes, and snippets.

@manoelf
Created August 22, 2016 18:45
Show Gist options
  • Save manoelf/11ff1fa95de9fe29189d8444dbe2587b to your computer and use it in GitHub Desktop.
Save manoelf/11ff1fa95de9fe29189d8444dbe2587b to your computer and use it in GitHub Desktop.
lista2.insertFirst(4);
lista2.insertFirst(3);
lista2.insertFirst(2);
lista2.insertFirst(1);
lista2.insertFirst(0);
Assert.assertArrayEquals(new Integer[] { 0, 1, 2, 3, 4 }, lista2.toArray());
lista2.remove(0);
Assert.assertArrayEquals(new Integer[] { 1, 2, 3, 4 }, lista2.toArray());
lista2.remove(1);
Assert.assertArrayEquals(new Integer[] { 2, 3, 4 }, lista2.toArray());
lista2.remove(2);
Assert.assertArrayEquals(new Integer[] { 3, 4 }, lista2.toArray());
lista2.remove(3);
Assert.assertArrayEquals(new Integer[] { 4 }, lista2.toArray());
lista2.remove(4);
Assert.assertArrayEquals(new Integer[] {}, lista2.toArray());
lista2.insertFirst(0);
lista2.insertFirst(1);
lista2.insertFirst(2);
lista2.insertFirst(3);
lista2.insertFirst(4);
Assert.assertArrayEquals(new Integer[] { 4, 3, 2, 1, 0 }, lista2.toArray());
lista2.removeLast();
Assert.assertArrayEquals(new Integer[] { 4, 3, 2, 1,}, lista2.toArray());
lista2.removeLast();
Assert.assertArrayEquals(new Integer[] { 4, 3, 2, }, lista2.toArray());
lista2.removeLast();
Assert.assertArrayEquals(new Integer[] { 4, 3 }, lista2.toArray());
lista2.removeLast();
Assert.assertArrayEquals(new Integer[] { 4 }, lista2.toArray());
lista2.removeLast();
Assert.assertArrayEquals(new Integer[] {}, lista2.toArray());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment