Return sequence instead of list from parse method
This commit is contained in:
parent
7c16182d61
commit
73e627b6be
@ -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