import java.util.*;

public class Anagram {

    private AnagramSubject subject;

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

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

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

        return anagrams;
    }

    class AnagramSubject {

        private String subject;
        private char[] fingerprint;

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

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

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

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


@@ -38,24 +38,30 @@
 gram %7B%0A%0A    
+final 
 private Anag
@@ -71,17 +71,24 @@
 Subject 
-s
+anagramS
 ubject;%0A
@@ -130,17 +130,24 @@
         
-s
+anagramS
 ubject =
@@ -357,17 +357,24 @@
     if (
-s
+anagramS
 ubject.a
@@ -498,16 +498,29 @@
  %7D%0A%0A    
+static final 
 class An
@@ -558,23 +558,20 @@
  String 
-subject
+word
 ;%0A      
@@ -564,32 +564,38 @@
 g word;%0A        
+final 
 private char%5B%5D f
@@ -636,36 +636,37 @@
 mSubject(String 
-word
+other
 ) %7B%0A            
@@ -674,22 +674,20 @@
 his.
-subject = word
+word = other
 ;%0A  
@@ -728,20 +728,21 @@
 icalize(
-word
+other
 );%0A     
@@ -779,36 +779,37 @@
 nagramOf(String 
-word
+other
 ) %7B%0A            
@@ -826,20 +826,21 @@
 plicate(
-word
+other
 ) && Arr
@@ -862,17 +862,16 @@
 erprint,
-(
 canonica
@@ -875,21 +875,21 @@
 icalize(
-word)
+other
 ));%0A    
@@ -928,36 +928,37 @@
 uplicate(String 
-word
+other
 ) %7B%0A            
@@ -968,15 +968,12 @@
 urn 
-subject
+word
 .equ
@@ -986,20 +986,21 @@
 oreCase(
-word
+other
 );%0A     
@@ -1040,36 +1040,37 @@
 nicalize(String 
-word
+other
 ) %7B%0A            
@@ -1084,20 +1084,21 @@
 chars = 
-word
+other
 .toLower

update java Anagram's example based on feedback