How to remove duplicates from list in Salesforce?

Create a map instead of list and finally insert or update the map values.

Sample Code:

Map<Id, Account> mapAccount = new Map<Id, Account>();

for(Account acc : listAccount){
...............
...............
mapAccount.put(acc.Id, acc);
}

update mapAccount.values();