idea常⽤for循环快捷键ations 快捷键
Live Templates
其实下⾯介绍的所有for循环都在live templates⾥⾯,当然可以⾃定义:
迭代器for循环
iter
Iterate iterable | Array in J2SDK 5 syntax
1.
1. for (String arg : args) {
2.
3. }
itar
Iterate elements of array
1. for (int j = 0; j < args.length; j++) {
2. String arg = args[j];
3.
4. }
itco
Iterate elements of java.util.Collection
1.
1. for (Iterator iterator = collection.iterator(); iterator.hasNext(); ) {
2. Object next = ();
3.
4. }
iten
Iterate java.util.Enumeration
1.
1. while (enumeration.hasMoreElements()) {
2. Object nextElement = Element();
3.
4. }
itit
Iterate java.util.Iterator
1.
1. while (iterator.hasNext()) {
2. Object next = ();
3.
4. }
itli
Iterate elements of java.util.List
1.
1. for (int j = 0; j < list.size(); j++) {
2. Object o = (j);
3.
4. }
ittok
Iterate tokens from String
1. for (StringTokenizer stringTokenizer = new StringTokenizer(); stringTokenizer.hasMoreTokens(); ) {
2. String s = Token();
3.
4. }
itve
Iterate elements of java.util.Vector
1.
1. for (int j = 0; j < vector.size(); j++) {
2. Object elementAt = vector.elementAt(j);
3.
4. }
以上快捷键在IDEA中输⼊it后,在IDEA的代码提⽰中均可以到。
普通for循环
fori
create iteration loop
1.
1. for (int j = 0; j < ; j++) {
2.
3. }
foreach
idea的快捷键
create a for each loop
1.
1. for (:
2. ) {
3.
4. }

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。