public static void deleteDupsWithBuffer(
      MyLinkedList list) {
    if (list != null) {
      HashMap<Integer, Object> map = new HashMap<Integer, Object>();
      MyLinkedList prev = null;
      while (list != null) {
        if (map.containsKey(list.getData())) {
          prev.setNext(list.getNext());
        } else {
          map.put(list.getData(), true);
          prev = list;
        }
        list = list.getNext();
      }

    }

  }