### Question:
SparseArray2DImpl implements ISparseArray2D<T> { @Override public List<T> getRowFor(int row) throws ArrayIndexOutOfBoundsException { if (row>this.row || row<0){ throw new ArrayIndexOutOfBoundsException(); } ArrayList<T> list = new ArrayList<T>(); IndexNode current = rowLinkedList.head; while (current!=null){ if (row==current.index){ ArrayNode<T> currentNode = current.head; while (currentNode!=null){ list.add(currentNode.data); currentNode = currentNode.nextCol; } current = current.next; } else{ current = current.next; } } return list ; } SparseArray2DImpl(int row, int column); @Override void putAt(int row, int col, T value); @Override T removeAt(int row, int col); @Override T getAt(int row, int col); @Override List<T> getRowFor(int row); @Override List<T> getColumnFor(int col);  }### Answer:
@Test public void testGetRowFor() { try { array.getRowFor(10001); assertTrue("You failed to detect row out of bounds", false); } catch (ArrayIndexOutOfBoundsException ae) { assertTrue(true); } List<String> list = array.getRowFor(100); assertTrue("You failed to return an empty list for an empty array", list.isEmpty()); array.putAt(10, 100, "C"); array.putAt(10, 150, "L"); array.putAt(30, 150, "D"); array.putAt(90, 150, "Z"); array.putAt(30, 100, "O"); array.putAt(30, 200, "T"); list = array.getRowFor(30); assertEquals("Returned row count incorrect", 3, list.size()); assertEquals("First row item wrong", "O", list.get(0)); assertEquals("Second row item wrong", "D", list.get(1)); assertEquals("Third row item wrong", "T", list.get(2)); list = array.getRowFor(1000); assertTrue("You failed to return an empty list for empty row", list.isEmpty()); }