code: public List<? extends ListCommand> repairCommands(final Queue<ListCommand> localCommands,
              final ListCommand remoteCommand) {
          this.localCommands = localCommands;
          if (remoteCommand instanceof AddToList) {
              return repairCommands((AddToList) remoteCommand);
          } else if (remoteCommand instanceof RemoveFromList) {
              return repairCommands((RemoveFromList) remoteCommand);
          } else if (remoteCommand instanceof ReplaceInList) {
              return repairCommands((ReplaceInList) remoteCommand);
          } else {
              throw failUnknownTyp(remoteCommand);
          }
      }
docs: Repairs the indices of local and remote {@link ListCommand}s.
  
  @param remoteCommand
  The remote command to repair.
  @param localCommands
  The local commands that should be repaired. After returning from this method, the queue will contain
  only the repaired commands.
  @return The commands that resulted from repairing the remote command.