gpt4 book ai didi

foreach 语法糖

转载 作者:知者 更新时间:2024-03-13 01:15:05 24 4
gpt4 key购买 nike

// 源码
public class Test {
    public static void test1() {
        int[] arr = {1, 2, 3, 4, 5};
        for (int i : arr) {
            System.out.println(i);
        }
    }

    public static void main(String[] args) {
        test1();
    }
}
// 反编译
public class Test {
    public Test() {
    }

    public static void test1() {
        int[] arr = new int[]{1, 2, 3, 4, 5};
        int[] var1 = arr;
        int var2 = arr.length;

        for(int var3 = 0; var3 < var2; ++var3) {
            int i = var1[var3];
            System.out.println(i);
        }

    }

    public static void main(String[] args) {
        test1();
    }
}
// 源码
import java.util.ArrayList;
import java.util.List;

public class Test {
    public static void test1() {
        List<Integer> list = new ArrayList<>();
        list.add(1);
        list.add(2);
        list.add(3);
        for (Integer integer : list) {
            System.out.println(integer);
        }
    }

    public static void main(String[] args) {
        test1();
    }
}
// 反编译
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Test {
    public Test() {
    }

    public static void test1() {
        List<Integer> list = new ArrayList();
        list.add(1);
        list.add(2);
        list.add(3);
        Iterator var1 = list.iterator();

        while(var1.hasNext()) {
            Integer integer = (Integer)var1.next();
            System.out.println(integer);
        }

    }

    public static void main(String[] args) {
        test1();
    }
}

创作打卡挑战赛

赢取流量/现金/CSDN周边激励大奖

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com