Skip to content

Instantly share code, notes, and snippets.

@hanaori
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hanaori/914f60842b791725ebab to your computer and use it in GitHub Desktop.
Save hanaori/914f60842b791725ebab to your computer and use it in GitHub Desktop.
Check whether the string has the same characters in it.
public class UniqunessCheck {
public boolean isUnique(String str){
boolean isUnique = true;
for(int i = 0; i < str.length(); i++){
for(int k = 0; k < str.length(); k++){
if(i != k){
if(str.charAt(i).equals(str.charAt(k))){
isUnique = false;
break;
}
}
}
}
return isUnique;
}
}
@hanaori
Copy link
Author

hanaori commented Mar 22, 2015

引数に渡された文字列に同じキャラクターが含まれないかチェックするメソッド

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment