Created
March 7, 2017 22:36
-
-
Save ragdroid/12e69ba4c48d4fe3af586fc548efe237 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Observable<String> getPokemonAbilityStringObservable(String id) { | |
return pokemonService.getPokemon(id) | |
.map(new Function<Pokemon, String>() { | |
@Override | |
public String apply(@NonNull Pokemon pokemon) throws Exception { | |
return constructAbility(pokemon); | |
} | |
}); | |
} | |
private static String constructAbility(Pokemon pokemon) { | |
StringBuilder builder = new StringBuilder(); | |
builder.append(constructPokemon(pokemon)); | |
for (Pokemon.Ability ability : pokemon.getAbilities()) { | |
builder.append("Ability Name : ") | |
.append(ability.getAbility().getName()) | |
.append("\n Is Hidden : ") | |
.append(ability.getIsHidden()); | |
} | |
return builder.toString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment