Sha256: fca4b5ad3a72af0366aabe8755a5cf52736fc840589b8fbfe1e14b963140412d
Contents?: true
Size: 684 Bytes
Versions: 34
Compression:
Stored size: 684 Bytes
Contents
package example; import java.util.HashSet; import java.util.Set; import static java.util.Arrays.stream; import static java.util.stream.Collectors.joining; public class IsogramChecker { public IsogramChecker(){ } public boolean isIsogram(String word){ Set<Character> charSet = new HashSet<>(); String[] words = word.split(" "); String newWord = concat(words); words = newWord.split("-"); newWord = concat(words).toLowerCase(); for(int i = 0; i < newWord.length(); i++){ charSet.add(newWord.charAt(i)); } return charSet.size() == newWord.length(); } private String concat(String[] words){ return stream(words).collect(joining()); } }
Version data entries
34 entries across 34 versions & 1 rubygems