|
Re: Understanding lambdas [message #1822842 is a reply to message #1822841] |
Sun, 15 March 2020 14:20 |
|
Hi, i cannot reproduce this. can you please provide a complete example.
package x
import com.google.common.collect.AbstractIterator
import com.google.common.io.LineReader
import java.io.InputStreamReader
import java.io.ByteArrayInputStream
import java.nio.charset.StandardCharsets
class Y {
def static void main(String[] args) {
val lineReader = new LineReader(new InputStreamReader(
new ByteArrayInputStream('''
Text
Red
Blue
Text
Red
Blue
'''.toString.getBytes(StandardCharsets.UTF_8))
));
val AbstractIterator<String> lineIterator = [|
val result = lineReader.readLine
if (result == null)
self.endOfData
return result
]
var line = ""
do {
line = lineIterator.next()
println('File contents [' + line + ']')
} while (line != null)
}
}
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03560 seconds