Created
March 15, 2016 23:29
-
-
Save valterbarros/b0cc9289d3bb908949a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package model; | |
import java.util.ArrayList; | |
import java.util.Iterator; | |
public class JavaApplication1 { | |
public static void main(String[] args) { | |
ArrayList a1 = new ArrayList(); | |
a1.add("valter"); | |
a1.add("juarez"); | |
a1.add("japonesa"); | |
a1.add("henrique"); | |
a1.add(5); | |
a1.add(6); | |
a1.add(6); | |
Iterator iter1 = a1.iterator(); | |
while(iter1.hasNext()){ | |
System.out.println(iter1.next()); | |
} | |
System.out.println("take item: " + a1.get(a1.indexOf("japonesa"))); | |
// for(Object element : a1){ | |
// System.out.println("Outra forma de iterar a lista: " + element); | |
// } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment