I have a custom list view which shows a list of items and the quantity of each item. The issue I'm facing is when I add a new item in the list, it repeats the items which were already present in the list. However, when I update the quantity of any of the items in the list, it shows perfectly. After doing some research, I found out that the reason why it is repeating the items already present in the list when a new item is added - I have .notifyDataSetChanged() in onChildAdded() method. But, I don't want to repeat those items when I add new items in the list.

Code Snippet:

```
public void displayToList(final String orderID, final String tableID, final String restaurantID) {

    final OrderDetailsholder orderDetailsholder = new OrderDetailsholder(OrderDetailsActivity.this, R.layout.order_details_layout, arrayList);
    orderDetailsList.setAdapter(orderDetailsholder);

    DatabaseReference activeOrders = FirebaseDatabase.getInstance().getReference("activeOrders");
    Query ordersQuery = activeOrders.child(restaurantID).child(tableID).child(orderID);
    ordersQuery.keepSynced(true);
    ordersQuery.addChildEventListener(new ChildEventListener() {
        @Override
        public void onChildAdded(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {

            //arrayList.clear();

            String dishName = dataSnapshot.child("productName").getValue(String.class);
            int dishQty = dataSnapshot.child("productQuantity").getValue(Integer.class);

            activeOrdersObj = new ActiveOrders(dishName, dishQty);
            arrayList.add(activeOrdersObj);

            orderDetailsholder.notifyDataSetChanged();

        }

        @Override
        public void onChildChanged(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {

            String dishName = dataSnapshot.child("productName").getValue(String.class);
            int dishQty = dataSnapshot.child("productQuantity").getValue(Integer.class);

            activeOrdersObj = new ActiveOrders(dishName, dishQty);
            arrayList.add(activeOrdersObj);

            orderDetailsholder.clear();

        }

        @Override
        public void onChildRemoved(@NonNull DataSnapshot dataSnapshot) {

        }

        @Override
        public void onChildMoved(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {

        }

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

        }
    });

}

```

Any idea on what should I add to resolve this?