Do you know how to get a list<Id> from a list<SObject>? Yes, doing a loop of the list of SObject and then put each record Id into another list or set.
What if this was possible in just one line of code?
Infact, it is possible to write this in just one line of code. Don't believe me? Take a look below.
Let say we have a list of contact records from which we only want to extract the list of record Ids.Cheers