一、JAVA风格迭代器
1、只读 QVectorIterator
QLinkedListIterator<QString> it(link);
while(it.hasNext())
{
qDebug()<<it.next();
}
2、读写 QMutableVectorIterator
QMutableLinkedListIterator<QString> it_mutable(link);
while(it_mutable.hasNext())
{
if(it_mutable.next() == "world")
it_mutable.insert("hello");
}
二、STL风格
1、只读 const_iterator
QLinkedList<QString>::const_iterator it = link.begin();
while(it != link.end())
{
qDebug()<<*it;
it++;
}
2、读写 iterator
QLinkedList<QString>::iterator it = link.begin();
while(it != link.end())
{
*it = "hello";
it++;
}