in auth/src/main/java/com/google/firebase/quickstart/AuthSnippets.java [153:171]
public static void listAllUsers() throws InterruptedException, ExecutionException {
// [START list_all_users]
// Start listing users from the beginning, 1000 at a time.
ListUsersPage page = FirebaseAuth.getInstance().listUsersAsync(null).get();
while (page != null) {
for (ExportedUserRecord user : page.getValues()) {
System.out.println("User: " + user.getUid());
}
page = page.getNextPage();
}
// Iterate through all users. This will still retrieve users in batches,
// buffering no more than 1000 users in memory at a time.
page = FirebaseAuth.getInstance().listUsersAsync(null).get();
for (ExportedUserRecord user : page.iterateAll()) {
System.out.println("User: " + user.getUid());
}
// [END list_all_users]
}