1. Consider mapping all your WorkOrders/Wrappers by a combination key (i.e UniqueKey__c + '.'+ Work_Order_Sequence__c.leftPad(10, '0') ). 2. sort your combo key list<string> comboKey = new List(mapWO.keyset()); combokey.sort(); 3. iterate through sorted combokey and create a new list of WorkOrders/Wrappers. LIST<WO> wo = new LIST<WO>(); for (string k : comboKey ) wo.add(mapWO.get(k)); should not need the to implement comparable since you are converting to padded number and can just leverage the standard alpha sort.