Skip to content

Instantly share code, notes, and snippets.

@keithrbennett
Created July 8, 2009 17:02
Show Gist options
  • Select an option

  • Save keithrbennett/142969 to your computer and use it in GitHub Desktop.

Select an option

Save keithrbennett/142969 to your computer and use it in GitHub Desktop.
public String getObject()
{
String result;
if (TO_ESCAPED_UNICODE.equals(translationType))
{
result = Strings.toEscapedUnicode(source);
}
else
{
result = Strings.fromEscapedUnicode(source);
}
return result;
}
public String getObjectImproved()
{
return TO_ESCAPED_UNICODE.equals(translationType)
? Strings.toEscapedUnicode(source)
: Strings.fromEscapedUnicode(source);
}
public String getObjectImprovedAgain()
{
boolean userWantsEscapeDirection = TO_ESCAPED_UNICODE.equals(translationType);
return userWantsEscapeDirection
? Strings.toEscapedUnicode(source)
: Strings.fromEscapedUnicode(source);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment