In the world of Harry Potter a wizard can remove a part of their soul and place it into another object through the act of homicide, thus creating a horcrux. Is the wizard able to direct their soul pieces such that they can choose what becomes a horcrux? Tied into that question, it seems possible that a wizard can kill someone and not create a horcrux (Peter Pettigrew killed Cedric Digory but no one seemed concerned that Peter made a horcrux), so how/why did Harry Potter wind up with a sliver of Voldemort's soul when it seems inconceivable that Voldemort's intention was to put one there?


Question: Illegal assignment from LIST to SET
Answer: There is simple way:

Set&lt;Account&gt; acc = new Set&lt;Account&gt;([SELECT id from Account]);


You cannot type cast a List&lt;sObjectType&gt; to Set&lt;sObjectType&gt; just by query assignment, pass it to Set constructor instead.