Convert List to Set And Set to List in Apex

Sample Code: