Return Sequence instead of List #6

Merged
marvinelsen merged 8 commits from update-versions into main 2024-09-24 10:10:55 +00:00
2 changed files with 2 additions and 2 deletions
Showing only changes of commit 73e627b6be - Show all commits

View File

@ -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() }

View File

@ -22,7 +22,7 @@ internal class CedictParserImpl : CedictParser {
override fun parseCedict(inputStream: InputStream) =
inputStream
.bufferedReader()
.readLines()
.lineSequence()
.filterNot(::isComment)
.map(::toCedictEntry)