mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-17 04:35:13 +07:00
IDEA-243019 Unroll loop: get loop size from dataflow
GitOrigin-RevId: 0ba4a16c098414fcb539502446b6cd138922f398
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7bef713cfd
commit
c180e2cec5
+19
@@ -0,0 +1,19 @@
|
||||
// "Unroll loop" "true"
|
||||
import java.util.Arrays;
|
||||
|
||||
class X {
|
||||
void test() {
|
||||
int[] array = new int[10];
|
||||
Arrays.setAll(array, i -> i);
|
||||
System.out.println(array[0]);
|
||||
System.out.println(array[1]);
|
||||
System.out.println(array[2]);
|
||||
System.out.println(array[3]);
|
||||
System.out.println(array[4]);
|
||||
System.out.println(array[5]);
|
||||
System.out.println(array[6]);
|
||||
System.out.println(array[7]);
|
||||
System.out.println(array[8]);
|
||||
System.out.println(array[9]);
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Unroll loop" "true"
|
||||
import java.util.Arrays;
|
||||
|
||||
class X {
|
||||
void testLoop(int size) {
|
||||
if (size == 5) {
|
||||
System.out.println(0);
|
||||
System.out.println(1);
|
||||
System.out.println(2);
|
||||
System.out.println(3);
|
||||
System.out.println(4);
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Unroll loop" "true"
|
||||
import java.util.List;
|
||||
|
||||
class X {
|
||||
void testList(List<String> list) {
|
||||
if (list.size() == 2) {
|
||||
System.out.println(list.get(0));
|
||||
System.out.println(list.get(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Unroll loop" "true"
|
||||
import java.util.Arrays;
|
||||
|
||||
class X {
|
||||
void test() {
|
||||
int[] array = new int[10];
|
||||
Arrays.setAll(array, i -> i);
|
||||
<caret>for (int i : array) {
|
||||
System.out.println(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Unroll loop" "true"
|
||||
import java.util.Arrays;
|
||||
|
||||
class X {
|
||||
void testLoop(int size) {
|
||||
if (size == 5) {
|
||||
<caret>for (int i = 0; i < size; i++) {
|
||||
System.out.println(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Unroll loop" "true"
|
||||
import java.util.List;
|
||||
|
||||
class X {
|
||||
void testList(List<String> list) {
|
||||
if (list.size() == 2) {
|
||||
<caret>for (String s : list) {
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user