Hi TestDemo,
Please use synchronous API instead of Asynchronous, it will work for you. Let me know if you need any help from my side.
I will be happy to help you!
P.S Use below code to get list of collections inside custom code:
String dbName = "Your_DataBase_Name";
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService();
Storage storage = storageService.findAllCollections(dbName);
System.out.println("dbName is " + storage.getDbName());
System.out.println("Collection Name is " + storage.getCollectionName());
Regards,
Himanshu Sharma