Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-13-2007, 11:18 AM
Java Tip's Avatar
Moderator
 
Join Date: Nov 2007
Posts: 1,691
Rep Power: 5
Java Tip will become famous soon enoughJava Tip will become famous soon enough
Default using ListIterator with ArrayList
List interface provides ListIterator to iterate through elements of the list. ArrayList implements the List interface and therefore ListIterator can be used to get all the elements stored in the ArrayList.

Code:
List listArray = new ArrayList();
		
listArray.add("Germany");
listArray.add("Holland");
listArray.add("Sweden");
		
ListIterator lI = listArray.listIterator();
		
while(lI.hasNext())
System.out.println(lI.next());
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java Project Trouble: Searching one ArrayList with another ArrayList BC2210 New To Java 2 04-21-2008 12:43 PM
Bidirectional Traversal with ListIterator Java Tip java.lang 0 04-16-2008 11:37 PM
ArrayList ramitmehra123 New To Java 1 02-07-2008 01:47 AM
ArrayList kizilbas1 New To Java 11 12-05-2007 08:30 PM
New to arraylist kleave New To Java 2 11-19-2007 07:45 PM


All times are GMT +2. The time now is 06:35 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org