List of usage examples for java.util List iterator
Iterator<E> iterator();
From source file:Main.java
public static void main(String[] args) { String[] array = { "A", "B", "C", "D" }; List list = Arrays.asList(array); Iterator iterator = list.iterator(); while (iterator.hasNext()) { System.out.println((String) iterator.next()); }/*from ww w .j a v a 2 s . c om*/ }
From source file:MainClass.java
public static void main(String args[]) { String[] a = new String[] { "a", "b", "c" }; List list = Arrays.asList(a); Iterator i = list.iterator(); while (i.hasNext()) { System.out.println(i.next()); }/*w w w .j a v a 2 s. c om*/ }
From source file:Main.java
public static void main(String[] args) { List list = Collections.nCopies(5, "A"); Iterator itr = list.iterator(); while (itr.hasNext()) System.out.println(itr.next()); }
From source file:MainClass.java
public static void main(String[] args) { List list = Arrays.asList("A", "B", "C", "D"); Iterator iterator = list.iterator(); while (iterator.hasNext()) { String element = (String) iterator.next(); System.out.println(element); }/*from ww w . ja v a 2s .c o m*/ }
From source file:MainClass.java
public static void main(String args[]) { List list = new ArrayList(Arrays.asList("a", "b", "c")); Iterator i = list.iterator(); while (i.hasNext()) { System.out.println(i.next()); list.add("Add"); }/*from w w w . j a v a 2s . c o m*/ }
From source file:MainClass.java
public static void main(String[] args) { List list = Arrays.asList("A", "B", "C", "D"); for (Iterator iterator = list.iterator(); iterator.hasNext();) { String element = (String) iterator.next(); System.out.println(element); }/*from w w w .j av a2s .c o m*/ }
From source file:HelloWorldBookmarks.java
public static void main(String[] args) throws Exception { PdfReader reader = new PdfReader("HelloWorldRead.pdf"); List list = SimpleBookmark.getBookmark(reader); for (Iterator i = list.iterator(); i.hasNext();) { showBookmark((Map) i.next()); }/*from w w w . j ava 2s .c o m*/ }
From source file:MainClass.java
public static void main(String[] a) { List list = Arrays.asList(new String[] { "A", "B", "C", "D" }); Iterator iter = list.iterator(); while (iter.hasNext()) { System.out.println(iter.next()); }//from w w w . j a v a2 s . com }
From source file:com.discursive.jccook.bean.BeanUtilExample.java
public static void main(String[] pArgs) { if (pArgs.length > 0 && pArgs[0] != null) { propName = pArgs[0];/*from w w w . j av a 2s . c o m*/ } System.out.println("Getting Property: " + propName); List books = createBooks(); Iterator i = books.iterator(); while (i.hasNext()) { Book book = (Book) i.next(); Object propVal = null; try { propVal = PropertyUtils.getProperty(book, propName); } catch (Exception e) { System.out.println("Error getting property: " + propName + ", from book: " + book.getName() + ", exception: " + e.getMessage()); } System.out.println("Property Value: " + propVal); } }
From source file:Main.java
public static void main(String[] args) { // Create a list of strings List<String> names = new ArrayList<>(); // Get an iterator for the list Iterator<String> nameIterator = names.iterator(); }