Question

In: Computer Science

Discuss the differences between a list's regular iterator, which supports the use of a "for" loop,...

Discuss the differences between a list's regular iterator, which supports the use of a "for" loop, and its other list iterator that supports position-based operations. Discuss the advantages and disadvantages of each.

Solutions

Expert Solution

Both iterator or list iterator is same for purpose ..i.e is to iterate through the list we have.
but the major difference between list iterator and iterator is quite simple

list iterator can iterate in both direction forward and backward direction ..it can move previous and even next.
but in regular iterator..it can iterate only in one direction.that is only unidirection.it can move only forward .
and one thing we should keep in mind that ..list iterator itarates only for list..but not for set map etc.
where as regular iterator works beyond than that.it uses form list ,map.set etc.

listiterator comes up with other benifit is..it can modify the data inside list during iteration like adding removing etc.
but in regualar iterator we cannot add element at a time of itearation..we can remove element ..

and another advantage of listiterator is..listiterator can get curent index position when traversing but ..normal iterator cannot give that ..as it get the index positon by using prev and next but normal iterator doesn not

iterator is not a class it is an interface and even listiterator is also an interface.

both are comes in java 1.2 and part of collection framework


Related Solutions

Discuss the fundamental differences between the Classical and Keynesian schools of macroeconomics. Use these differences to...
Discuss the fundamental differences between the Classical and Keynesian schools of macroeconomics. Use these differences to motivate a discussion of how inflationary and recessionary gaps can be eliminated through the use of discretionary fiscal policy. Use a graphical analysis and conclude by considering the long-run ramifications of adopting a fiscal budget that is sensitive to movements in the business cycle.
Made differences between the financial statements of a non-profit and regular? Please use an example from...
Made differences between the financial statements of a non-profit and regular? Please use an example from each financial statement
What are the differences between regular and irregular items on an income statement? What are the...
What are the differences between regular and irregular items on an income statement? What are the requirements for items to qualify as irregular? What are some examples of irregular items? What is the effect of irregular items on an investor’s analysis of a company?
Discuss the differences between utilization and efficiency as measures of system performance. Which (if any) is...
Discuss the differences between utilization and efficiency as measures of system performance. Which (if any) is the most useful measure for an operations manager? Why?
consider the use of mergers verses corporate alliances in growing a company. Discuss the differences between...
consider the use of mergers verses corporate alliances in growing a company. Discuss the differences between a merger and a corporate alliance. In 5 sentences. Explain the pros and cons of both and how taxes influence the use of each approach.
Discuss the main differences (minimum 3) between the firewall and IDS? Use the diagram to illustrate...
Discuss the main differences (minimum 3) between the firewall and IDS? Use the diagram to illustrate the components for the types of IDS vs firewall. Use two or three sentences to discuss the differences based on your understanding?(no more than 300 words
Discuss the differences and similarities between these three business forms : 1. Differences and similarities between...
Discuss the differences and similarities between these three business forms : 1. Differences and similarities between LLC in USA vs SARL in Lebanon 2. Corporation in USA vs S.A.L in Lebanon 3. General Partnership in USA vs. Unlimited Partnership in Lebanon
What is close loop and open loop in controls, what are the differences and what are...
What is close loop and open loop in controls, what are the differences and what are their similarities. Please illustrate using a block diagram if possible
Discuss the differences between Excel and Access, when you would use one over the other and...
Discuss the differences between Excel and Access, when you would use one over the other and how/when you can use them together to achieve a goal.
Discuss the differences in friendships between women and those between men.
Discuss the differences in friendships between women and those between men.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT