本文整理匯總了PHP中ArrayList::iterator方法的典型用法代碼示例。如果您正苦於以下問題:PHP ArrayList::iterator方法的具體用法?PHP ArrayList::iterator怎麽用?PHP ArrayList::iterator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ArrayList
的用法示例。
在下文中一共展示了ArrayList::iterator方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: registerObserver
public function registerObserver(Observer $observer)
{
$iterator = $this->ducks->iterator();
while ($iterator->hasNext()) {
$duck = $iterator->next();
$duck->registerObserver($observer);
}
}
示例2: quack
public function quack()
{
$iterator = $this->quackers->iterator();
while ($iterator->hasNext()) {
$quacker = $iterator->next();
$quacker->quack();
}
}
示例3: myPrint
public function myPrint()
{
print "\n" . $this->getName();
println(", " . $this->getDescription());
println("---------------------");
$iterator = $this->menuComponents->iterator();
while ($iterator->hasNext()) {
$menuComponent = $iterator->next();
$menuComponent->myPrint();
}
}
示例4: printMenu
public function printMenu(MyIterator $iterator = NULL)
{
if ($iterator == NULL) {
$menuIterator = $this->menus->iterator();
while ($menuIterator->hasNext()) {
$menu = $menuIterator->next();
printMenu($menu->createIterator());
}
} else {
while ($iterator->hasNext()) {
$menuItem = $iterator->next();
print $menuItem->getName() . ", ";
print $menuItem->getPrice() . " -- ";
println($menuItem->getDescription());
}
}
}
示例5: getObservers
public function getObservers()
{
return $this->observers->iterator();
}
示例6: createIterator
public function createIterator()
{
return $this->menuItems->iterator();
}