I have a firebase database. When I get value from the snapshot, I have HashMap in below:
and I have a Snap class like below. How can I cast the DataSnapshot to List of the class such as
List<Snap> snapList = (HashMap<String,Object>) dataSnapshot.child(USER_PHONE).child("friends").getValue();
public class Snap {
String key;
String value;
public Snap(){
}
public Snap(String key, String value) {
this.key = key;
this.value = value;
}
public String getKey() {
return key;
}
public String getValue() {
return value;
}
}