我对RxJava(以及一般的反应范式)都很陌生,所以请耐心等待.
假设我有这个News和这个嵌套的Comment数据结构:
public class News {
public int id;
public int[] commentIds; //only top level comments
public News(int id, int[] commentIds) {
this.id = id;
this.commentIds = commentIds;
}
}
public class Comment {
public int id;
public int parentId; //ID of parent News or parent comment
public int[] childIds;
public Comment(int id, int parentId, int[] childIds) {
this.id = id;
this.parentId = parentId;
this.childIds = childIds;
}
}
Run Code Online (Sandbox Code Playgroud)
并假设我有这个API端点:
getComments(int commentId) …Run Code Online (Sandbox Code Playgroud)