How to update an item stored in an ArrayList? (Android)
<p>I am fetching data from <code>Firebase</code> and after fetching the supposed data, I stored it on an <code>ArrayList</code>. So here is the sample code.</p>

<pre><code>markerArray = new ArrayList&lt;&gt;();
Firebase ref = new Firebase(Config.FIREBASE_URL_DRIVER);
ref.addValueEventListener(new ValueEventListener() {
    @Override
    public void onDataChange(DataSnapshot dataSnapshot) {
        if (dataSnapshot.getChildrenCount() == 0) {
            markerInfo();
        } else {
            for (DataSnapshot snapshot : dataSnapshot.getChildren()) {
                name = snapshot.child("driversName").getValue().toString().trim();
                busNum = snapshot.child("busNum").getValue().toString().trim();
                latitude = Double.valueOf(snapshot.child("latitude").getValue().toString().trim());
                longitude = Double.valueOf(snapshot.child("longitude").getValue().toString().trim());
                availableSeat = snapshot.child("availableSeat").getValue().toString().trim();
                estimatedTime = snapshot.child("estimatedTime").getValue().toString().trim();
                if ((!latitude.equals(null) || latitude.equals(0)) &amp;&amp; (!longitude.equals(null) || longitude.equals(0)) &amp;&amp; availableSeat.equals("") &amp;&amp; (!estimatedTime.equals("") || estimatedTime.equals("0"))) {
                    convertLatLong();
                    getTotalPass();
                    Toast.makeText(MainMapActivity.this, currentLocation+" :currentLocation", Toast.LENGTH_SHORT).show();
                    markerArray.add(new Driver(name, totalPassenger, busNum, latitude, longitude, currentLocation, estimatedTime));
                }
            }
            Toast.makeText(MainMapActivity.this, "markerArraySize: "+markerArray.size(), Toast.LENGTH_SHORT).show();
            for (i = 0; i &lt; markerArray.size(); i++) {
                createMarker(markerArray.get(i).getDriversName(), markerArray.get(i).getTotalPassenger(), markerArray.get(i).getBusNum(), markerArray.get(i).getLatitude(), markerArray.get(i).getLongitude(), markerArray   .get(i).getLocation(), markerArray.get(i).getEstimatedTime());
            }
        }
    }
}
</code></pre>

<p>I want to update my <code>ArrayList</code> so that whenever there are changes on the Firebase (especially the latitude and longitude) being fetched, the markers will not be redundant/multiply.</p>