Return Sequence instead of List #6
@ -4,7 +4,7 @@ import com.marvinelsen.cedict.internal.CedictParserImpl
|
||||
import java.io.InputStream
|
||||
|
||||
interface CedictParser {
|
||||
fun parseCedict(inputStream: InputStream): List<CedictEntry>
|
||||
fun parseCedict(inputStream: InputStream): Sequence<CedictEntry>
|
||||
|
||||
companion object {
|
||||
val instance: CedictParser by lazy { CedictParserImpl() }
|
||||
|
@ -22,7 +22,7 @@ internal class CedictParserImpl : CedictParser {
|
||||
override fun parseCedict(inputStream: InputStream) =
|
||||
inputStream
|
||||
.bufferedReader()
|
||||
.readLines()
|
||||
.lineSequence()
|
||||
.filterNot(::isComment)
|
||||
.map(::toCedictEntry)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user