Set operations behind comparing two lists
Union, intersection, and difference in plain terms, plus why de-duplication and case handling change which items land in each group.
The four groups are set operations
Comparing two lists is really applying set theory to text. 'In both' is the intersection, the items shared by List A and List B. 'Only in A' and 'Only in B' together form the symmetric difference, the items that belong to exactly one list. The 'Union' is everything combined with no repeats. Naming the groups this way helps when you move the same idea into SQL, a spreadsheet formula, or a script, because each group maps to a standard operation.
Why de-duplication comes first
A set has no repeated members, so before anything is compared each list is reduced to its distinct items, keeping the first occurrence. That is why a List A of red, red, green, blue behaves like red, green, blue. Without this step, counts would be misleading and an item that appeared twice could show up in two groups. De-duplicating up front keeps the four groups clean and their counts meaningful.
Case sensitivity changes the keys
Whether two strings match depends on the key used to compare them. By default the key is the exact text, so 'Apple' and 'apple' are different members. Turning on 'Ignore case' lowercases the key used for matching while still displaying the original text, so the two collapse into one item shown with its first-seen casing. Trimming works the same way by stripping edge whitespace before the key is formed, which is why a line with a trailing space still matches its clean twin.
Turning results into action
Once the groups are computed, each one is a ready-made worklist. 'Only in A' is often a list of things to add somewhere, 'Only in B' is what to remove or reconcile, and 'In both' confirms overlap. Because every group has its own copy button, you can paste a single slice into a deployment allowlist, a mailing-list cleanup, or a diff report without hand-editing. The live counts also give a quick sanity check that the two inputs are the size you expected.