You can create a Set in Apex as below
Set<String> colorSet = new Set<String> {'Red', 'Blue', 'Orange'};
To create list, use the syntax below
List<String> colorList = new List<String> {'Brown', 'Black', 'Green', 'White'};
Convert from List to Set
Set<String> newColorSet= new Set<String>(colorList);
Convert from Set to List
List<String> newColorList = new List<String>(colorSet);
You can also use other ways like using addAll
colorList.addAll(colorSet); colorSet.addAll(colorList);