src/main/scala/anagram.scala

1
2
3
4
5
6
7
class Anagram(word: String) {
  def isAnagram(candidate: String): Boolean =
    word.toLowerCase.sorted == candidate.toLowerCase.sorted &&
    word.toLowerCase != candidate.toLowerCase

  def matches(wordList: Seq[String]): Seq[String] = wordList.filter(isAnagram _)
}

@abo64 thinks this looks great

Comments

Switch to camel case naming

helenst commented 17 March 2016 at 11:51 UTC

You're not logged in right now. Please login via GitHub to comment