Advertisement
Guest User

Untitled

a guest
Jan 19th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. public static List<UserPayer> getAllPayees(String myUid) {
  2. List<String> bids = new ArrayList<>();
  3.  
  4. //asynchronously retrieve all documents
  5. ApiFuture<QuerySnapshot> future = db.collection("debts").get();
  6. // future.get() blocks on response
  7. List<QueryDocumentSnapshot> documents = null;
  8. try {
  9. documents = future.get().getDocuments();
  10. } catch (InterruptedException e) {
  11. e.printStackTrace();
  12. } catch (ExecutionException e) {
  13. e.printStackTrace();
  14. }
  15.  
  16. for (QueryDocumentSnapshot document : documents) {
  17. System.out.println(document.getId() + "\n");
  18. bids.add(document.getId());
  19. }
  20.  
  21. List<UserPayer> users = new ArrayList<>();
  22. for (String s: bids) {
  23. List<UserPayer> temp = getPayers(s);
  24. for (UserPayer: temp) {
  25. if (u.uid.equals(myUid)) {
  26. users.add(u);
  27. }
  28. }
  29. }
  30.  
  31. return users;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement