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.1.0.1 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.1.0.0 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.55 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.54 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.53 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.52 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.51 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.50 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.49 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.48 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.47 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.46 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.45 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.44 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.43 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.42 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.41 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.40 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.39 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
trackler-2.0.8.38 tracks/java/exercises/isogram/src/example/java/IsogramChecker.java