//Creating Map with account id as key and account record as value Map<Id,Account> accountMap = new Map<Id,Account>([SELECT Id, Name, Site, Rating, AccountNumber From Account LIMIT 100]); //Getting list of account using map.values method List<account> accList = accountMap.values(); //Getting set of account Id's using map.keySet method Set<Id> accIdSet = accountMap.keySet(); //Getting list of account Id's using list.addAll method List<Id> accIdList.addAll(accIdSet);