- Joined
- Jul 20, 2006
So I have a Comment class contacting JSON objects which I want to store in a list like so:
class Comment(commentJSON: JSONObject) : Serializable {
private lateinit var commentDate: String
lateinit var humanDate: String
lateinit var commentId: String
lateinit var commentBody: String
lateinit var child: List<Comment>
}
So far so good. The problem comes when I want to initialize the "child" List:
init {
try {
commentDate = commentJSON.getString(COMMENT_DATE)
humanDate = convertDateToHumanDate()
commentBody = commentJSON.getString(words)
commentID = commentJSON.getString(cname)
child = listof()
}
}
I'm not really sure I should even be using "listof" and... if so... I have no idea what to put in the parenthesis.
class Comment(commentJSON: JSONObject) : Serializable {
private lateinit var commentDate: String
lateinit var humanDate: String
lateinit var commentId: String
lateinit var commentBody: String
lateinit var child: List<Comment>
}
So far so good. The problem comes when I want to initialize the "child" List:
init {
try {
commentDate = commentJSON.getString(COMMENT_DATE)
humanDate = convertDateToHumanDate()
commentBody = commentJSON.getString(words)
commentID = commentJSON.getString(cname)
child = listof()
}
}
I'm not really sure I should even be using "listof" and... if so... I have no idea what to put in the parenthesis.