I want to create a master list in Firebase Realtime database using java in which the keys should be auto generated as well as consecutive numbers (0,1,2...). Something like
I will add the child data whenever user feeds. but i do not precisely know the what the last id stored. for example, if i had 3 records (IDs: 0,1,2) already, and user feeds me one more, I have to set the new data with the id '3' which i do not exactly know.
Is there any way to automatically add data with consecutive numbers?
As an alternative I'm using .push()
method which gives me some random id which i dont actually like.