docs: private void autoRepair() {
      ArrayList<Integer> trash = new ArrayList<>();
      HashMap<Integer, Integer> translation = new HashMap<>();
      HashMap<Integer, MtasToken> newTokenCollection = new HashMap<>();
      Integer parentId;
      Integer maxId = null;
      Integer minId = null;
      MtasToken token;
      // check id, position and value
      for (Entry<Integer, MtasToken> entry : tokenCollection.entrySet()) {
        token = entry.getValue();
        boolean putInTrash;
        putInTrash = token.getId() == null;
        putInTrash |= (token.getPositionStart() == null)
            || (token.getPositionEnd() == null);
        putInTrash |= token.getValue() == null || (token.getValue().isEmpty());
        putInTrash |= token.getPrefix() == null || (token.getPrefix().isEmpty());
        if (putInTrash) {
          trash.add(entry.getKey());
        }
      }
      // check parentId
      for (Entry<Integer, MtasToken> entry : tokenCollection.entrySet()) {
        token = entry.getValue();
        parentId = token.getParentId();
        if (parentId != null && (!tokenCollection.containsKey(parentId)
            || trash.contains(parentId))) {
          token.setParentId(null);
        }
      }
      // empty bin
      if (!trash.isEmpty()) {
        for (Integer i : trash) {
          tokenCollection.remove(i);
        }
      }
      // always check ids
      if (tokenCollection.size() > 0) {
        for (Integer i : tokenCollection.keySet()) {
          maxId = ((maxId == null) ? i : Math.max(maxId, i));
          minId = ((minId == null) ? i : Math.min(minId, i));
        }
        // check
        if ((minId > 0) || ((1 + maxId - minId) != tokenCollection.size())) {
          int newId = 0;
          // create translation
          for (Integer i : tokenCollection.keySet()) {
            translation.put(i, newId);
            newId++;
          }
          // translate objects
          for (Entry<Integer, MtasToken> entry : tokenCollection.entrySet()) {
            token = entry.getValue();
            parentId = token.getParentId();
            token.setId(translation.get(entry.getKey()));
            if (parentId != null) {
              token.setParentId(translation.get(parentId));
            }
          }
          // new tokenCollection
          Iterator<Map.Entry<Integer, MtasToken>> iter = tokenCollection
              .entrySet().iterator();
          while (iter.hasNext()) {
            Map.Entry<Integer, MtasToken> entry = iter.next();
            newTokenCollection.put(translation.get(entry.getKey()),
                entry.getValue());
            iter.remove();
          }
          tokenCollection = newTokenCollection;
        }
      }
    }