Firebase DatabaseException: Can’t convert object of type java.util.ArrayList to my type Object

I’m building an app in Android Studio and tried everything to read my database into the type Object I have set up and I’m stuck on this error, would really appreciate some help:
com.google.firebase.database.DatabaseException: Can’t convert object of type java.util.ArrayList to my type object.

This is my snapshot and eventlistener setup that is producing the error:

public class CountryDetailsActivity extends AppCompatActivity {

ListView lvCases;
List<CountryDetails> caseList;
DatabaseReference databaseCases;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_country_details);

    databaseCases = FirebaseDatabase.getInstance().getReference();
    lvCases = findViewById(R.id.lvSearchResults);
    caseList = new ArrayList<CountryDetails>();
}

@Override
protected void onStart() {
    super.onStart();
    databaseCases.addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
            caseList.clear();
            for (DataSnapshot caseSnapshot : dataSnapshot.getChildren()) {
                CountryDetails cases = caseSnapshot.getValue(CountryDetails.class);
                caseList.add(cases);
            }
        }

        @Override
        public void onCancelled(@NonNull DatabaseError databaseError) { }
    });
}

This is my CountryDetails class minus some setters and gettters:

String Country;
String NewConfirmed;
String NewDeaths;
String TotalConfirmed;
String TotalCases;
String TotalRecovered;

public CountryDetails() {


public CountryDetails(String Country, String NewConfirmed, String NewDeaths, String TotalConfirmed, String TotalCases, String TotalRecovered) {
    this.NewConfirmed = NewConfirmed;
    this.NewDeaths = NewDeaths;
    this.TotalConfirmed = TotalConfirmed;
    this.Country = Country;
    this.TotalCases = TotalCases;
    this.TotalRecovered = TotalRecovered;
}

public String getCountry() {
    return Country;
}

public void setCountry(String country) {
    Country = country;
}

And this is what my database structure looks like: https://i.stack.imgur.com/adhoi.jpg

Where am I going wrong here?

Answer

I think you are having wrong reference if you are trying to fetch data of Countriesnode

Solution Code (add “Countries” in reference)

databaseCases = FirebaseDatabase.getInstance().getReference("Countries");