小编Hov*_*nix的帖子

如何在RxJava中执行递归可观察调用?

我对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)

java reactive-programming observable rx-java

9
推荐指数
1
解决办法
6944
查看次数

标签 统计

java ×1

observable ×1

reactive-programming ×1

rx-java ×1