public class MapToListAndSet {

    // Method to convert Map values to a List
    public static List<String> mapToList(Map<Integer, String> inputMap) {
        List<String> resultList = new List<String>();
        resultList.addAll(inputMap.values());
        return resultList;
    }

    // Method to convert Map keys to a Set
    public static Set<Integer> mapToSet(Map<Integer, String> inputMap) {
        Set<Integer> resultSet = new Set<Integer>();
        resultSet.addAll(inputMap.keySet());
        return resultSet;
    }

    // Method to test the functionality of mapToList and mapToSet
    public static void testMethods() {
        // Create a sample map
        Map<Integer, String> sampleMap = new Map<Integer, String>();
        sampleMap.put(1, 'Apple');
        sampleMap.put(2, 'Banana');
        sampleMap.put(3, 'Cherry');

        // Get List of values
        List<String> resultList = mapToList(sampleMap);
        System.debug('List of Map Values: ' + resultList);

        // Get Set of keys
        Set<Integer> resultSet = mapToSet(sampleMap);
        System.debug('Set of Map Keys: ' + resultSet);
    }
}