allow forEachLine block to return Any which avoids possible compile errors from some blocks which return values

This commit is contained in:
James Strachan
2012-04-18 09:05:59 +01:00
parent e60aae5374
commit 2460c78d38
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -86,7 +86,7 @@ public inline fun File.reader(): FileReader = FileReader(this)
/**
* Iterates through each line of this file then closing the underlying [[Reader]] when its completed
*/
public inline fun File.forEachLine(block: (String) -> Unit): Unit = reader().forEachLine(block)
public inline fun File.forEachLine(block: (String) -> Any): Unit = reader().forEachLine(block)
/**
* Reads the entire content of the file as bytes
+1 -1
View File
@@ -212,7 +212,7 @@ public inline fun Writer.buffered(bufferSize: Int = defaultBufferSize): Buffered
/**
* Iterates through each line of this reader then closing the [[Reader]] when its completed
*/
public inline fun Reader.forEachLine(block: (String) -> Unit): Unit {
public inline fun Reader.forEachLine(block: (String) -> Any): Unit {
this.use{
val iter = buffered().lineIterator()
while (iter.hasNext) {