We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import java.util.ArrayList; import java.util.Iterator; public class getData { public static void main(String[] args) { ArrayList<String> gd = new ArrayList<>(); gd.add("xiaomei"); gd.add("jiahao"); gd.add("xc"); gd.add("wrf"); gd.add("chengzhang"); gd.add("zilong"); gd.add("huifeng"); gd.add("yuxin"); gd.add("xiaoxia"); gd.add("dingjiang"); //方法一 Iterator it = gd.iterator();// 获取迭代器 while (it.hasNext()) { System.out.println(it.next()); } //方法二 for(Iterator iq = gd.iterator(); iq.hasNext();) { System.out.println(it.next()); } // 方法三 for (Object obj:gd ) { String string = (String )obj; System.out.println(string); if ( string.equals("xiaoxia")) { gd.remove(string); } } System.out.println(gd); // 方法四 gd.stream().forEach(p -> System.out.println(gd)); } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: