#dedupe Clear
Tags #php #kotlin #bash #go #sql #rust #typescript #html #java #python #files #utils #strings #http #concurrency #async #json #arrays #security #types #crypto #database #dates #format
Bash Deduplicate Array (preserve order)
Bash's associative arrays let you dedupe in a single pass while keeping the original order — `sort -u` would shuffle.
Bash Unique While Preserving Order
`sort -u` re-orders. `awk '!seen[$0]++'` is the classic order-preserving dedupe — and it's a single line.
Python unique_everseen — Order-Preserving Dedupe
Remove duplicates while preserving original order (set() loses order on collisions). Optional key function lets you dedupe by a derived value — e.g., lowercased email.
PHP Unique by Callback
Like array_unique, but the uniqueness test is a callback that returns the key to dedupe by. Useful for "unique by ID" or "unique by lowercased email" across arrays of objects/rows.
TypeScript uniqueBy — Dedupe by Callback
Deduplicate an array using a derived key (object id, lowercased email, etc.). First occurrence wins. Backed by a Map for O(n) performance.