mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-15 09:57:04 +05:30
refactor: make CommentNode#toString
non-recursive
This commit is contained in:
parent
16cc116b00
commit
8947c3a3bc
1 changed files with 9 additions and 3 deletions
|
@ -38,9 +38,9 @@ internal data class CommentNode(
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [CommentNode.equals] and [CommentNode.hashCode] are hand-rolled to drop the
|
* [CommentNode.equals], [CommentNode.toString] and [CommentNode.hashCode] are hand-rolled to drop
|
||||||
* [CommentNode.parent] field from the comparison since it's possible for there to be cycles in
|
* the [CommentNode.parent] field from the comparison since it's possible for there to be cycles
|
||||||
* this comparison check. For our purposes we're fine with foregoing the field.
|
* in this comparison check. For our purposes we're fine with foregoing the field.
|
||||||
*/
|
*/
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (this === other) return true
|
if (this === other) return true
|
||||||
|
@ -65,4 +65,10 @@ internal data class CommentNode(
|
||||||
result = 31 * result + isExpanded.hashCode()
|
result = 31 * result + isExpanded.hashCode()
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "CommentNode(comment=${comment.shortId}, isPostAuthor=$isPostAuthor, " +
|
||||||
|
"children=${children.size}, isUnread=$isUnread, indentLevel=$indentLevel, " +
|
||||||
|
"isExpanded=$isExpanded)"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue