import java.util.*;

public class Anagram {

    final private AnagramSubject anagramSubject;

    public Anagram(String word) {
        anagramSubject = new AnagramSubject(word);
    }

    public List<String> match(List<String> candidates) {
        List<String> anagrams = new ArrayList<String>();

        for (String candidate : candidates) {
            if (anagramSubject.anagramOf(candidate)) {
                anagrams.add(candidate);
            }
        }

        return anagrams;
    }

    static final class AnagramSubject {

        private String word;
        final private char[] fingerprint;

        public AnagramSubject(String other) {
            this.word = other;
            this.fingerprint = canonicalize(other);
        }

        public boolean anagramOf(String other) {
            return !duplicate(other) && Arrays.equals(fingerprint,canonicalize(other));
        }

        private boolean duplicate(String other) {
            return word.equalsIgnoreCase(other);
        }

        private char[] canonicalize(String other) {
            char[] chars = other.toLowerCase().toCharArray();
            Arrays.sort(chars);
            return chars;
        }
    }
}


@@ -42,30 +42,24 @@
  %7B%0A%0A    
-final 
 private 
 AnagramS
@@ -50,16 +50,22 @@
 private 
+final 
 AnagramS
@@ -551,16 +551,22 @@
 private 
+final 
 String w
@@ -582,22 +582,16 @@
     
-final 
 private 
 char
@@ -582,24 +582,30 @@
     private 
+final 
 char%5B%5D finge

change attributes modifier for AnagramSubject to *private final*