/** * @return void */ public function testRemoveIndex() { $listObject = new ArrayList(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)); $listObject->removeIndex(4); $listObject->removeIndex(10); $listObject->removeIndex(15); $array = array(); foreach ($listObject as $key => $value) { $array[] = $value; } $this->assertEquals(10, count($array)); $this->assertEquals(1, $array[0]); $this->assertEquals(2, $array[1]); $this->assertEquals(3, $array[2]); $this->assertEquals(4, $array[3]); $this->assertEquals(6, $array[4]); $this->assertEquals(7, $array[5]); $this->assertEquals(8, $array[6]); $this->assertEquals(9, $array[7]); $this->assertEquals(10, $array[8]); $this->assertEquals(12, $array[9]); }
echo '<br/>'; echo '<br/>'; echo '<br/>'; echo 'remove value: '; echo '<br/>'; $listObject = new ArrayList(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); $listObject->remove(4); $listObject->remove(10); $listObject->remove(15); echo 'Count: '; echo count($listObject); echo '<br/>'; echo 'remove index: '; echo '<br/>'; $listObject = new ArrayList(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)); $listObject->removeIndex(4); $listObject->removeIndex(10); $listObject->removeIndex(15); echo 'Count: '; echo count($listObject); echo '<br/>'; echo '<br/>'; echo '<br/>'; echo 'is empty (has any entries): '; if ($listObject->isEmpty()) { echo 'FALSE'; } else { echo 'TRUE'; } echo '<br/>'; echo 'clear list';