fun Post.unwrapQuotes(): List<Post> {
val quotes = mutableListOf(this)
var currentQuote = quote
while (currentQuote != null) {
quotes.add(0, currentQuote)
currentQuote = currentQuote.quote
}
return quotes
}what was I thinking?
fun Post.unwrapQuotes(): List<Post> {
val quotes = mutableListOf(this)
var currentQuote = quote
while (currentQuote != null) {
quotes.add(0, currentQuote)
currentQuote = currentQuote.quote
}
return quotes
}