Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
a2fc5b67
Commit
a2fc5b67
authored
7 years ago
by
Roman.Ivanov
Browse files
Options
Download
Email Patches
Plain Diff
fix tests for foreach formatting
parent
301141e6
Branches unavailable
Tags unavailable
No related merge requests found
Changes
83
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
java/java-tests/testData/codeInsight/completeStatement/ForEach_after.java
+1
-1
...testData/codeInsight/completeStatement/ForEach_after.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterConflictsWithForeachParamAndLambdaParamNames.java
+1
-1
...da/afterConflictsWithForeachParamAndLambdaParamNames.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterNameConflictsWithForeachParam.java
+1
-1
.../anonymous2lambda/afterNameConflictsWithForeachParam.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/iterateOver/after1.java
+1
-1
...sight/daemonCodeAnalyzer/quickFix/iterateOver/after1.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/iterateOver/after2.java
+1
-1
...sight/daemonCodeAnalyzer/quickFix/iterateOver/after2.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/filter/afterFilterMapForEach.java
+1
-1
...kFix/streamApiMigration/filter/afterFilterMapForEach.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterAllMatch.java
+7
-7
...emonCodeAnalyzer/quickFix/streamToLoop/afterAllMatch.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterAnyMatch.java
+3
-3
...emonCodeAnalyzer/quickFix/streamToLoop/afterAnyMatch.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterAnyMatchPolyadic.java
+1
-1
...Analyzer/quickFix/streamToLoop/afterAnyMatchPolyadic.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterAnyMatchPolyadicAssignment.java
+1
-1
...uickFix/streamToLoop/afterAnyMatchPolyadicAssignment.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterAnyMatchPolyadicAssignmentNot.java
+1
-1
...kFix/streamToLoop/afterAnyMatchPolyadicAssignmentNot.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterAnyMatchPolyadicNot.java
+1
-1
...lyzer/quickFix/streamToLoop/afterAnyMatchPolyadicNot.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterArraySkipDistinctCount.java
+1
-1
...er/quickFix/streamToLoop/afterArraySkipDistinctCount.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterAverage.java
+3
-3
...aemonCodeAnalyzer/quickFix/streamToLoop/afterAverage.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterBlockVoidLambda.java
+6
-6
...eAnalyzer/quickFix/streamToLoop/afterBlockVoidLambda.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterBoxed.java
+1
-1
.../daemonCodeAnalyzer/quickFix/streamToLoop/afterBoxed.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterCapturedWildcard.java
+1
-1
...Analyzer/quickFix/streamToLoop/afterCapturedWildcard.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterCollect3.java
+1
-1
...emonCodeAnalyzer/quickFix/streamToLoop/afterCollect3.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterCollectExtends.java
+5
-5
...deAnalyzer/quickFix/streamToLoop/afterCollectExtends.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterCollector.java
+11
-11
...monCodeAnalyzer/quickFix/streamToLoop/afterCollector.java
with
49 additions
and
49 deletions
+49
-49
java/java-tests/testData/codeInsight/completeStatement/ForEach_after.java
+
1
-
1
View file @
a2fc5b67
class
Foo
{
{
List
list
;
for
(
String
s
:
list
)
{
for
(
String
s:
list
)
{
<
caret
>
}
}
...
...
This diff is collapsed.
Click to expand it.
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterConflictsWithForeachParamAndLambdaParamNames.java
+
1
-
1
View file @
a2fc5b67
...
...
@@ -3,7 +3,7 @@ class Test2 {
void
foo
(
final
List
<
PatchLogger
>
loggers
)
{
final
PatchLogger
logger
=
logger1
->
{
for
(
PatchLogger
logger2
:
loggers
)
{
for
(
PatchLogger
logger2:
loggers
)
{
logger2
.
logOperation
(
logger1
);
}
};
...
...
This diff is collapsed.
Click to expand it.
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterNameConflictsWithForeachParam.java
+
1
-
1
View file @
a2fc5b67
...
...
@@ -3,7 +3,7 @@ class Test2 {
void
foo
(
final
List
<
PatchLogger
>
loggers
)
{
final
PatchLogger
logger
=
s
->
{
for
(
PatchLogger
logger1
:
loggers
)
{
for
(
PatchLogger
logger1:
loggers
)
{
logger1
.
logOperation
(
s
);
}
};
...
...
This diff is collapsed.
Click to expand it.
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/iterateOver/after1.java
+
1
-
1
View file @
a2fc5b67
...
...
@@ -3,7 +3,7 @@ import java.lang.annotation.Annotation;
// "Iterate" "true"
class
Test
{
void
foo
()
{
for
(
Annotation
annotation
:
getClass
().
getAnnotations
())
{
for
(
Annotation
annotation:
getClass
().
getAnnotations
())
{
}
...
...
This diff is collapsed.
Click to expand it.
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/iterateOver/after2.java
+
1
-
1
View file @
a2fc5b67
...
...
@@ -3,7 +3,7 @@ import java.lang.annotation.Annotation;
// "Iterate" "true"
class
Test
{
void
foo
()
{
for
(
Annotation
annotation
:
getClass
().
getAnnotations
())
{
for
(
Annotation
annotation:
getClass
().
getAnnotations
())
{
}
...
...
This diff is collapsed.
Click to expand it.
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/filter/afterFilterMapForEach.java
+
1
-
1
View file @
a2fc5b67
...
...
@@ -7,7 +7,7 @@ public class Main {
public
void
test
(
Map
<
String
,
String
[]>
map
)
{
List
<
String
>
result
=
new
ArrayList
<>();
map
.
entrySet
().
stream
().
filter
(
entry
->
entry
.
getKey
().
startsWith
(
"x"
)).
map
(
Map
.
Entry
::
getValue
).
forEach
(
arr
->
{
for
(
String
str
:
arr
)
{
for
(
String
str:
arr
)
{
result
.
add
(
str
.
trim
()
+
arr
.
length
);
}
});
...
...
This diff is collapsed.
Click to expand it.
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterAllMatch.java
+
7
-
7
View file @
a2fc5b67
...
...
@@ -6,9 +6,9 @@ import static java.util.Arrays.asList;
public
class
Main
{
public
static
boolean
test
(
List
<
List
<
String
>>
list
)
{
for
(
List
<
String
>
x
:
list
)
{
for
(
List
<
String
>
x:
list
)
{
if
(
x
!=
null
)
{
for
(
String
s
:
x
)
{
for
(
String
s:
x
)
{
if
(!
s
.
startsWith
(
"a"
))
{
return
false
;
}
...
...
@@ -19,7 +19,7 @@ public class Main {
}
private
static
boolean
testEqEq
(
List
<
String
>
list
)
{
for
(
String
s
:
list
)
{
for
(
String
s:
list
)
{
if
(
s
.
trim
()
!=
s
.
toLowerCase
())
{
return
false
;
}
...
...
@@ -30,9 +30,9 @@ public class Main {
public
static
void
testIf
(
List
<
List
<
String
>>
list
)
{
boolean
b
=
true
;
OUTER:
for
(
List
<
String
>
x
:
list
)
{
for
(
List
<
String
>
x:
list
)
{
if
(
x
!=
null
)
{
for
(
String
s
:
x
)
{
for
(
String
s:
x
)
{
if
(!
s
.
startsWith
(
"a"
))
{
b
=
false
;
break
OUTER
;
...
...
@@ -46,7 +46,7 @@ public class Main {
}
boolean
testNot
(
String
...
strings
)
{
for
(
String
s
:
strings
)
{
for
(
String
s:
strings
)
{
if
(
s
!=
null
)
{
if
(!
s
.
startsWith
(
"xyz"
))
{
return
true
;
...
...
@@ -58,7 +58,7 @@ public class Main {
public
void
testVar
(
List
<
Integer
>
list
)
{
boolean
x
=
false
;
for
(
Integer
i
:
list
)
{
for
(
Integer
i:
list
)
{
if
(
i
<=
2
)
{
x
=
true
;
break
;
...
...
This diff is collapsed.
Click to expand it.
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterAnyMatch.java
+
3
-
3
View file @
a2fc5b67
...
...
@@ -6,9 +6,9 @@ import static java.util.Arrays.asList;
public
class
Main
{
public
static
boolean
test
(
List
<
List
<
String
>>
list
)
{
for
(
List
<
String
>
x
:
list
)
{
for
(
List
<
String
>
x:
list
)
{
if
(
x
!=
null
)
{
for
(
String
s
:
x
)
{
for
(
String
s:
x
)
{
if
(
s
.
startsWith
(
"a"
))
{
return
true
;
}
...
...
@@ -19,7 +19,7 @@ public class Main {
}
String
testTernary
(
String
[]
strings
)
{
for
(
String
s
:
strings
)
{
for
(
String
s:
strings
)
{
if
(
s
!=
null
)
{
if
(!
s
.
startsWith
(
"xyz"
))
{
return
"s"
;
...
...
This diff is collapsed.
Click to expand it.
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterAnyMatchPolyadic.java
+
1
-
1
View file @
a2fc5b67
...
...
@@ -5,7 +5,7 @@ import java.util.List;
public
class
Main
{
public
boolean
testCond
(
List
<
String
>
list
)
{
for
(
String
s
:
list
)
{
for
(
String
s:
list
)
{
if
(
s
.
isEmpty
())
{
return
list
.
stream
().
anyMatch
(
Objects:
:
isNull
);
}
...
...
This diff is collapsed.
Click to expand it.
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterAnyMatchPolyadicAssignment.java
+
1
-
1
View file @
a2fc5b67
...
...
@@ -6,7 +6,7 @@ import java.util.List;
public
class
Main
{
public
boolean
testCond
(
List
<
String
>
list
)
{
boolean
x
=
false
;
for
(
String
s
:
list
)
{
for
(
String
s:
list
)
{
if
(
s
.
isEmpty
())
{
x
=
list
.
stream
().
anyMatch
(
Objects:
:
isNull
);
break
;
...
...
This diff is collapsed.
Click to expand it.
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterAnyMatchPolyadicAssignmentNot.java
+
1
-
1
View file @
a2fc5b67
...
...
@@ -6,7 +6,7 @@ import java.util.List;
public
class
Main
{
public
boolean
testCond
(
List
<
String
>
list
)
{
boolean
b
=
true
;
for
(
String
s
:
list
)
{
for
(
String
s:
list
)
{
if
(
s
.
isEmpty
())
{
b
=
false
;
break
;
...
...
This diff is collapsed.
Click to expand it.
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterAnyMatchPolyadicNot.java
+
1
-
1
View file @
a2fc5b67
...
...
@@ -5,7 +5,7 @@ import java.util.List;
public
class
Main
{
public
boolean
testCond
(
List
<
String
>
list
)
{
for
(
String
s
:
list
)
{
for
(
String
s:
list
)
{
if
(
s
.
isEmpty
())
{
return
false
;
}
...
...
This diff is collapsed.
Click to expand it.
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterArraySkipDistinctCount.java
+
1
-
1
View file @
a2fc5b67
...
...
@@ -9,7 +9,7 @@ public class Main {
long
count
=
0L
;
Set
<
Integer
>
uniqueValues
=
new
HashSet
<>();
long
toSkip
=
1
;
for
(
Integer
integer
:
new
Integer
[]{
1
,
2
,
3
,
2
,
3
})
{
for
(
Integer
integer:
new
Integer
[]{
1
,
2
,
3
,
2
,
3
})
{
if
(
toSkip
>
0
)
{
toSkip
--;
continue
;
...
...
This diff is collapsed.
Click to expand it.
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterAverage.java
+
3
-
3
View file @
a2fc5b67
...
...
@@ -7,7 +7,7 @@ public class Main {
private
static
OptionalDouble
testDouble
(
long
...
numbers
)
{
double
sum
=
0
;
long
count
=
0
;
for
(
long
x
:
numbers
)
{
for
(
long
x:
numbers
)
{
if
(
x
>
0
)
{
double
v
=
x
;
sum
+=
v
;
...
...
@@ -20,7 +20,7 @@ public class Main {
private
static
OptionalDouble
testInt
(
int
...
numbers
)
{
long
sum
=
0
;
long
count
=
0
;
for
(
int
x
:
numbers
)
{
for
(
int
x:
numbers
)
{
if
(
x
>
0
)
{
sum
+=
x
;
count
++;
...
...
@@ -32,7 +32,7 @@ public class Main {
private
static
OptionalDouble
testLong
(
long
...
numbers
)
{
long
sum
=
0
;
long
count
=
0
;
for
(
long
x
:
numbers
)
{
for
(
long
x:
numbers
)
{
if
(
x
>
0
)
{
sum
+=
x
;
count
++;
...
...
This diff is collapsed.
Click to expand it.
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterBlockVoidLambda.java
+
6
-
6
View file @
a2fc5b67
...
...
@@ -12,7 +12,7 @@ import java.util.stream.Stream;
public
class
Main
{
public
static
void
main
(
String
[]
args
)
{
List
<
String
>
list
=
Arrays
.
asList
(
"a"
,
"b"
,
"c"
,
"d"
);
for
(
String
o
:
list
)
{
for
(
String
o:
list
)
{
if
(!
o
.
isEmpty
())
{
System
.
out
.
println
(
"Peek: "
+
o
);
System
.
out
.
println
(
"Peek2: "
+
o
);
...
...
@@ -33,7 +33,7 @@ public class Main {
}
}
for
(
String
s
:
list
)
{
for
(
String
s:
list
)
{
if
(
"b"
.
equals
(
s
))
{
System
.
out
.
println
(
"Found:"
);
System
.
out
.
println
(
s
);
...
...
@@ -41,7 +41,7 @@ public class Main {
}
}
Optional
<
String
>
found
=
Optional
.
empty
();
for
(
String
qq
:
list
)
{
for
(
String
qq:
list
)
{
if
(
"b"
.
equals
(
qq
))
{
found
=
Optional
.
of
(
qq
);
break
;
...
...
@@ -54,7 +54,7 @@ public class Main {
});
StringBuilder
res
=
new
StringBuilder
();
for
(
String
str
:
list
)
{
for
(
String
str:
list
)
{
if
(
str
!=
null
)
{
str
=
"["
+
str
+
"]"
;
res
.
append
(
str
);
...
...
@@ -63,7 +63,7 @@ public class Main {
System
.
out
.
println
(
res
);
long
count
=
0L
;
for
(
String
n
:
list
)
{
for
(
String
n:
list
)
{
if
(!
"a"
.
equals
(
n
))
{
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
System
.
out
.
println
(
"In flatmap idx: "
+
i
);
...
...
@@ -76,7 +76,7 @@ public class Main {
}
void
test
(
List
<
String
>
list
)
{
for
(
String
x
:
list
)
{
for
(
String
x:
list
)
{
if
(
x
.
isEmpty
())
continue
;
System
.
out
.
println
(
x
);
}
...
...
This diff is collapsed.
Click to expand it.
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterBoxed.java
+
1
-
1
View file @
a2fc5b67
...
...
@@ -8,7 +8,7 @@ import java.util.stream.Collectors;
public
class
Main
{
private
static
List
<
Integer
>
test
(
int
[]
numbers
)
{
List
<
Integer
>
list
=
new
ArrayList
<>();
for
(
int
number
:
numbers
)
{
for
(
int
number:
numbers
)
{
Integer
integer
=
number
;
list
.
add
(
integer
);
}
...
...
This diff is collapsed.
Click to expand it.
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterCapturedWildcard.java
+
1
-
1
View file @
a2fc5b67
...
...
@@ -14,7 +14,7 @@ public class Main {
public
static
OptionalInt
min
(
IndexSet
<?>
set
)
{
boolean
seen
=
false
;
int
best
=
0
;
for
(
Index
index
:
set
.
asList
())
{
for
(
Index
index:
set
.
asList
())
{
int
asInteger
=
index
.
asInteger
();
if
(!
seen
||
asInteger
<
best
)
{
seen
=
true
;
...
...
This diff is collapsed.
Click to expand it.
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterCollect3.java
+
1
-
1
View file @
a2fc5b67
...
...
@@ -7,7 +7,7 @@ import java.util.Objects;
public
class
Main
{
private
static
void
test
(
List
<
String
>
list
)
{
StringBuilder
sb
=
new
StringBuilder
();
for
(
String
str
:
list
)
{
for
(
String
str:
list
)
{
if
(
str
!=
null
)
{
sb
.
append
(
str
);
}
...
...
This diff is collapsed.
Click to expand it.
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterCollectExtends.java
+
5
-
5
View file @
a2fc5b67
...
...
@@ -19,7 +19,7 @@ public class Main {
private
void
collect
()
{
List
<
CharSequence
>
list
=
new
ArrayList
<>();
for
(
CharSequence
charSequence
:
getListExtends
())
{
for
(
CharSequence
charSequence:
getListExtends
())
{
if
(
charSequence
!=
null
)
{
list
.
add
(
charSequence
);
}
...
...
@@ -30,7 +30,7 @@ public class Main {
private
void
collect2
()
{
List
<
List
<?
extends
CharSequence
>>
list
=
new
ArrayList
<>();
for
(
CharSequence
charSequence
:
getListExtends
())
{
for
(
CharSequence
charSequence:
getListExtends
())
{
List
<?
extends
CharSequence
>
charSequences
=
asList
(
charSequence
);
list
.
add
(
charSequences
);
}
...
...
@@ -44,7 +44,7 @@ public class Main {
private
void
collectCustomList
()
{
MyList
<?
extends
List
<?
extends
CharSequence
>>
res2
=
new
MyList
<>();
for
(
CharSequence
charSequence
:
getListExtends
())
{
for
(
CharSequence
charSequence:
getListExtends
())
{
List
<?
extends
CharSequence
>
charSequences
=
asList
(
charSequence
);
res2
.
add
(
charSequences
);
}
...
...
@@ -60,7 +60,7 @@ public class Main {
private
void
collectGroupingByCustomList
()
{
Map
<
Integer
,
MyList2
<?
extends
Number
,
CharSequence
>>
result
=
new
HashMap
<>();
for
(
CharSequence
x
:
getList
())
{
for
(
CharSequence
x:
getList
())
{
result
.
computeIfAbsent
(
x
.
length
(),
k
->
createMyList2
()).
add
(
x
);
}
Map
<
Integer
,
?
extends
MyList2
<?
extends
Number
,
?
extends
CharSequence
>>
map
=
...
...
@@ -70,7 +70,7 @@ public class Main {
private
void
collectToMap
()
{
Map
<
CharSequence
,
List
<?
extends
CharSequence
>>
result
=
new
HashMap
<>();
for
(
CharSequence
charSequence
:
getList
())
{
for
(
CharSequence
charSequence:
getList
())
{
if
(
charSequence
!=
null
)
{
if
(
result
.
put
(
charSequence
,
asList
(
charSequence
))
!=
null
)
{
throw
new
IllegalStateException
(
"Duplicate key"
);
...
...
This diff is collapsed.
Click to expand it.
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterCollector.java
+
11
-
11
View file @
a2fc5b67
...
...
@@ -8,7 +8,7 @@ public class Main {
public
void
testAveragingDouble
(
String
...
list
)
{
double
sum
=
0
;
long
count
=
0
;
for
(
String
s
:
list
)
{
for
(
String
s:
list
)
{
if
(
s
!=
null
)
{
sum
+=
1.0
/
s
.
length
();
count
++;
...
...
@@ -20,7 +20,7 @@ public class Main {
public
void
testAveragingInt
(
String
...
list
)
{
long
sum
=
0
;
long
count
=
0
;
for
(
String
s
:
list
)
{
for
(
String
s:
list
)
{
if
(
s
!=
null
)
{
sum
+=
s
.
length
();
count
++;
...
...
@@ -31,7 +31,7 @@ public class Main {
public
static
long
testCounting
(
List
<
String
>
strings
)
{
long
count
=
0L
;
for
(
String
s
:
strings
)
{
for
(
String
s:
strings
)
{
if
(!
s
.
isEmpty
())
{
count
++;
}
...
...
@@ -42,7 +42,7 @@ public class Main {
public
static
Optional
<
String
>
testMaxBy
(
List
<
String
>
strings
)
{
boolean
seen
=
false
;
String
best
=
null
;
for
(
String
s
:
strings
)
{
for
(
String
s:
strings
)
{
if
(!
s
.
isEmpty
())
{
if
(!
seen
||
s
.
compareTo
(
best
)
>
0
)
{
seen
=
true
;
...
...
@@ -56,7 +56,7 @@ public class Main {
public
static
Optional
<
String
>
testReducing1
(
List
<
String
>
list
)
{
boolean
seen
=
false
;
String
acc
=
null
;
for
(
String
s
:
list
)
{
for
(
String
s:
list
)
{
if
(!
seen
)
{
seen
=
true
;
acc
=
s
;
...
...
@@ -69,7 +69,7 @@ public class Main {
public
static
String
testReducing2
(
List
<
String
>
list
)
{
String
acc
=
""
;
for
(
String
s
:
list
)
{
for
(
String
s:
list
)
{
acc
=
acc
+
s
;
}
return
acc
;
...
...
@@ -77,7 +77,7 @@ public class Main {
static
Integer
testReducing3
()
{
Integer
totalLength
=
0
;
for
(
String
s
:
Arrays
.
asList
(
"a"
,
"bb"
,
"ccc"
))
{
for
(
String
s:
Arrays
.
asList
(
"a"
,
"bb"
,
"ccc"
))
{
Integer
length
=
s
.
length
();
totalLength
=
totalLength
+
length
;
}
...
...
@@ -86,7 +86,7 @@ public class Main {
public
static
DoubleSummaryStatistics
testSummarizingDouble
(
List
<
String
>
strings
)
{
DoubleSummaryStatistics
stat
=
new
DoubleSummaryStatistics
();
for
(
String
str
:
strings
)
{
for
(
String
str:
strings
)
{
if
(
str
!=
null
)
{
stat
.
accept
(
str
.
length
()
/
2.0
);
}
...
...
@@ -96,7 +96,7 @@ public class Main {
public
static
Double
testSummingDouble
(
List
<
String
>
strings
)
{
double
sum
=
0.0
;
for
(
String
string
:
strings
)
{
for
(
String
string:
strings
)
{
if
(
string
!=
null
)
{
sum
+=
string
.
length
();
}
...
...
@@ -106,7 +106,7 @@ public class Main {
private
static
TreeSet
<
Integer
>
testToCollection
()
{
TreeSet
<
Integer
>
integers
=
new
TreeSet
<>();
for
(
int
i
:
new
int
[]{
4
,
2
,
1
})
{
for
(
int
i:
new
int
[]{
4
,
2
,
1
})
{
Integer
integer
=
i
;
integers
.
add
(
integer
);
}
...
...
@@ -116,7 +116,7 @@ public class Main {
// Unresolved reference
void
f
(
Collection
<?
extends
Foo
>
c
)
{
R
treeSet
=
new
TreeSet
();
for
(
Foo
foo
:
c
)
{
for
(
Foo
foo:
c
)
{
treeSet
.
add
(
foo
);
}
Set
<
Foo
>
uniqueDescriptors
=
treeSet
;
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
3
4
5
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help