New J2K: use nullable type for unknown for public declarations & prepare for mutability inference
#KT-32518 fixed
This commit is contained in:
+3
-3
@@ -2,12 +2,12 @@ import java.util.stream.Collectors
|
||||
|
||||
internal class Test {
|
||||
fun main(lst: List<String>) {
|
||||
val toList: List<String> = lst.stream().collect(Collectors.toList())
|
||||
val toSet: Set<String> = lst.stream().collect(Collectors.toSet())
|
||||
val toList = lst.stream().collect(Collectors.toList())
|
||||
val toSet = lst.stream().collect(Collectors.toSet())
|
||||
val count = lst.stream().count()
|
||||
val anyMatch = lst.stream().anyMatch { v: String -> v.isEmpty() }
|
||||
val allMatch = lst.stream().allMatch { v: String -> v.isEmpty() }
|
||||
val noneMatch = lst.stream().noneMatch { v: String -> v.isEmpty() }
|
||||
lst.stream().forEach { v: String -> println(v) }
|
||||
lst.stream().forEach { v: String? -> println(v) }
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -4,23 +4,23 @@ import java.util.stream.Stream
|
||||
|
||||
internal class Test {
|
||||
fun main(lst: List<String>) {
|
||||
val streamOfList: List<String> = lst.stream()
|
||||
val streamOfList = lst.stream()
|
||||
.map { x: String -> x + "e" }
|
||||
.collect(Collectors.toList())
|
||||
val streamOfElements: List<Int> = Stream.of(1, 2, 3)
|
||||
val streamOfElements = Stream.of(1, 2, 3)
|
||||
.map { x: Int -> x + 1 }
|
||||
.collect(Collectors.toList())
|
||||
val array = arrayOf(1, 2, 3)
|
||||
val streamOfArray: List<Int> = Arrays.stream(array)
|
||||
val streamOfArray = Arrays.stream(array)
|
||||
.map { x: Int -> x + 1 }
|
||||
.collect(Collectors.toList())
|
||||
val streamOfArray2: List<Int> = Stream.of(*array)
|
||||
val streamOfArray2 = Stream.of(*array)
|
||||
.map { x: Int -> x + 1 }
|
||||
.collect(Collectors.toList())
|
||||
val streamIterate: List<Int> = Stream.iterate(2, { v: Int -> v * 2 })
|
||||
val streamIterate = Stream.iterate(2, { v: Int -> v * 2 })
|
||||
.map { x: Int -> x + 1 }
|
||||
.collect(Collectors.toList())
|
||||
val streamGenerate: List<Int> = Stream.generate { 42 }
|
||||
val streamGenerate = Stream.generate { 42 }
|
||||
.map { x: Int -> x + 1 }
|
||||
.collect(Collectors.toList())
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import java.util.stream.Stream
|
||||
|
||||
internal class Test {
|
||||
fun main(lst: List<String?>?) {
|
||||
val stream: Stream<Int> = Stream.of(1)
|
||||
val list: List<Int> = stream.collect(Collectors.toList())
|
||||
val stream = Stream.of(1)
|
||||
val list = stream.collect(Collectors.toList())
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -3,11 +3,11 @@ import java.util.stream.Collectors
|
||||
|
||||
internal class Test {
|
||||
fun main(lst: List<Int>) {
|
||||
val newLst: List<Int> = /*before list*/lst/*after list*/.stream/*before stream*/()/* after stream*/
|
||||
val newLst = /*before list*/lst/*after list*/.stream/*before stream*/()/* after stream*/
|
||||
.filter { x: Int -> x > 10 }
|
||||
.map { x: Int -> x + 2 }/*some comment*/.distinct/*another comment*/()/* one more comment */.sorted()/*another one comment*/
|
||||
.sorted(Comparator.naturalOrder())
|
||||
.peek { x: Int -> println(x) }.limit(1)
|
||||
.peek { x: Int? -> println(x) }.limit(1)
|
||||
.skip(42)/*skipped*/
|
||||
/*collecting one*/.collect/*collecting two */(Collectors.toList())/* cool */
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,14 +3,14 @@ import java.util.stream.Stream
|
||||
|
||||
internal class Test {
|
||||
fun main() {
|
||||
val activities: List<String> = Stream.of("12")
|
||||
val activities = Stream.of("12")
|
||||
.map { v: String -> v + "nya" }
|
||||
.filter { v: String? -> v != null }
|
||||
.flatMap { v: String ->
|
||||
Stream.of(v)
|
||||
.flatMap { s: String -> Stream.of(s) }
|
||||
}.filter { v: String ->
|
||||
val name: String = v.javaClass.name
|
||||
val name = v.javaClass.name
|
||||
if (name == "name") {
|
||||
return@filter false
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,13 +3,13 @@ import java.util.stream.Collectors
|
||||
|
||||
internal class Test {
|
||||
fun main(lst: List<Int>) {
|
||||
val newLst: List<Int> = lst.stream()
|
||||
val newLst = lst.stream()
|
||||
.filter { x: Int -> x > 10 }
|
||||
.map { x: Int -> x + 2 }
|
||||
.distinct()
|
||||
.sorted()
|
||||
.sorted(Comparator.naturalOrder())
|
||||
.peek { x: Int -> println(x) }
|
||||
.peek { x: Int? -> println(x) }
|
||||
.limit(1)
|
||||
.skip(42)
|
||||
.collect(Collectors.toList())
|
||||
|
||||
Reference in New Issue
Block a user