public static List<Id> getUniqueIds(List<Id> ids) {
    Id[] idsArray = ids.toArray(new Id[ids.size()]);
    Arrays.sort(idsArray);

    List<Id> uniqueList = new ArrayList<Id>();

    for (Id id : idsArray) {
      if (uniqueList.isEmpty() || (!id.equals(uniqueList.get(uniqueList.size() - 1)))) {
        uniqueList.add(id);
      }
    }

    return uniqueList;
  }