Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions clean-code-challanges/src/main/java/IsogramChecker.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.util.*;

/**
* Determine if a word or phrase is an isogram.
*
Expand All @@ -16,7 +18,9 @@
class IsogramChecker {

boolean isIsogram(String phrase) {
throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
phrase = phrase.replaceAll("[\\s\\-]", "").toLowerCase();
Set<Character> charSet = new LinkedHashSet<>();
phrase.chars().forEach(e -> charSet.add((char) e));
return phrase.toCharArray().length == charSet.size();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

@Ignore

public class IsogramCheckerTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
Expand All @@ -7,6 +8,7 @@

import static org.junit.Assert.assertEquals;

@Ignore
@RunWith(Parameterized.class)
public class PigLatinTranslatorTest {

Expand Down