package org.jabref.gui.importer.actions;

import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

import javax.swing.JOptionPane;

import org.jabref.gui.BasePanel;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.entry.BibEntry;

public class MergeReviewIntoCommentConfirmation {

    private final BasePanel panel;

    public MergeReviewIntoCommentConfirmation(BasePanel panel) {
        this.panel = panel;
    }

    public boolean askUserForMerge(List<BibEntry> conflicts) {
        List<String> bibKeys = conflicts.stream()
                .map(BibEntry::getCiteKeyOptional)
                .filter(Optional::isPresent)
                .map(Optional::get)
                .collect(Collectors.toList());

        int answer = JOptionPane.showConfirmDialog(
                panel,
                String.join(",\n", bibKeys) + " " +
                        Localization.lang("has/have both a 'Comment' and a 'Review' field.") + "\n" +
                        Localization.lang("Since the 'Review' field was deprecated in JabRef 4.2, these two fields are about to be merged into the 'Comment' field.") + "\n" +
                        Localization.lang("The conflicting fields of these entries will be merged into the 'Comment' field."),
                Localization.lang("Review Field Migration"), JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE);

        return 0 == answer;
    }
}

@@ -534,20 +534,14 @@
     
-List%3C
 String
-%3E
  bib
@@ -738,15 +738,21 @@
 ors.
-toList(
+joining(%22,%5Cn%22
 ));%0A
@@ -846,35 +846,16 @@
     
- String.join(%22,%5Cn%22,
  bibKeys
 ) + 
@@ -850,17 +850,16 @@
  bibKeys
-)
  + %22 %22 +

use joining collector