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

Version Path
trackler-2.0.8.37 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.36 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.35 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.34 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.33 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.32 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.31 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.30 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.29 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.28 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.27 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.26 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.24 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.23 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java