Anagrams for a given input 2.0 This question follows on from :Previous Question

Here is what my reworked code looks like. I neatened it up as much as I could. Changed some of the semantics of it. I also tried to add some faster exit points and checks to prevent errors.

Any further critiques?

 /**
 * @author              :KyleMHB
 * Project Number       :0002
 * Project Name         :Anagramatic
 * IDE                  :NETBEANS
 * Goal of Project      - 
 * Capture user input, compare to a dictionary file for anagrams,
 * output number of matches and the matches.
 */

package anagramatic;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;
import javax.swing.JOptionPane; 


-

public class Anagramatic {
public static void main(String[] args) throws FileNotFoundException{
    String anagram=getInput("Enter the word you would like to process");
    List&lt;String&gt; words=readAnagramsFromFile(anagram, new File("words.txt"));
    String output= formatOutput(anagram,words);
    displayOutput(output);
}//pvsm


-

private static String getInput(String prompt) {
    String input = JOptionPane.showInputDialog(null,prompt);
    return input;
}//getInput


-

  private static List readAnagramsFromFile(String word, File f) 
        throws FileNotFoundException{
    ArrayList&lt;String&gt; anagrams = new ArrayList&lt;&gt;(); 
    try(Scanner s = new Scanner(f)){
        while(s.hasNext()){
            String candidate=s.next();
            if ( (candidate.length()==word.length()) &amp;&amp;
                    (checkMatch(word,candidate)==true)){
                anagrams.add(candidate);
            }
        }
}
    return anagrams;
}//readFile


-

private static boolean checkMatch(String word, String candidate) {
    char[] wordArray = word.toCharArray();
    char[] candidateArray = candidate.toCharArray();
    if (Arrays.equals(wordArray, candidateArray)){
        return false;
    }
    Arrays.sort(wordArray);
    Arrays.sort(candidateArray);
    if(Arrays.equals(wordArray, candidateArray)){
        return true;
    }
    /**I did not use an else function for the the below return
    *because if (Arrays.equals(wordArray, candidateArray))==true
    *it will break on the return*/
    return false;

}//match


-

private static String formatOutput(String original, List&lt;String&gt; words) {
    StringBuilder output=new StringBuilder("[ ");
    int counter=0;
    Iterator&lt;String&gt; wordIt =words.iterator();
    while(wordIt.hasNext()){
       output.append(wordIt.next());
       if(wordIt.hasNext()){
           output.append((++counter % 8 == 0)? ",\n" : ", ");
       }
    }
    output.append(" ]");
    return ("The Anagram "+original+" has "+words.size()+" matches.\n\nThey are:\n"+output.toString());
}//formatOutput


-

private static void displayOutput(String output){
    JOptionPane.showMessageDialog(null,output);
}//displayOutput
}
Four issues with private static boolean checkMatch(String word, String candidate):


checkMatch is not as descriptive as a name could be.  I think private static boolean isAnagram(String a, String b) would be better.  I would also rename the parameters to acknowledge that they are symmetrical: it doesn't matter which is the original word, and which is the candidate.
You don't need to end with an if-else.  You can just say return Arrays.equals(wordArray, candidateArray);
You would be re-sorting the characters of the original word each time you test a candidate.  That's OK, I suppose, if you prefer clean code over efficiency.
Why not start with

private static boolean isAnagram(String a, String b) {
    if (a.length() != b.length()) {
        return false;
    }

    // Continue with a thorough comparison...
    ...
}


Then the code in readAnagramsFromFile() can read very smoothly:

if (isAnagram(word, candidate)) {
    anagrams.add(candidate);
}



Note that the return type of readAnagramsFromFile() should be List&lt;String&gt;, not just a generic List.