The Artima Developer Community
Sponsored Link

Java Buzz Forum
Java - Iterator Example and Tutorial

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Javin Paul

Posts: 1090
Nickname: javinpaul
Registered: Jan, 2012

Javin Paul is Java Programmer working on Finance domain.
Java - Iterator Example and Tutorial Posted: Feb 27, 2013 6:41 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Javin Paul.
Original Post: Java - Iterator Example and Tutorial
Feed Title: Java67
Feed URL: http://www.java67.com/feeds/posts/default?alt=rss
Feed Description: Java and technology tutorials, tips, questions for all programmers.
Latest Java Buzz Posts
Latest Java Buzz Posts by Javin Paul
Latest Posts From Java67

Advertisement
Java Iterator is used to iterate over Collections in Java. By Iteration, I mean, going over each element stored in collection and optionally performing some operation e.g. printing value of element, updating object or removing object from Collection. Iterator was not part of first Java release, and a similar class Enumeration was there to provide Iteration functionality. Iterator in Java was introduced form JDK 1.4 and it provides alternative to Enumeration, which is obsolete now days. Iterator is different to Enumeration in two main ways, first, Iterator allows programmer to remove elements from Collection during iteration. Second, names are shortened and improved in Iterator, by the way, you can see difference between Iterator and Enumeration for more differences. It's one of the frequently asked Java Interview question. Iterator is an interface and enhanced to support Generic from Java 1.5 release. Almost all popular collection implements Iterator, including ArrayList, LinkedList and HashSet. hasNext() method of Iterator is used as condition while Iterating, and next() method actually returns object, next in sequence maintained by Collection itself. In this Java programming tutorial, we will learn How to use Iterator in Java by coding Iterator example and iterating over ArrayList.
Read more ยป

Read: Java - Iterator Example and Tutorial

Topic: How expensive is a method call in Java Previous Topic   Next Topic Topic: Quick Java Favor

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use