Skip to content

Instantly share code, notes, and snippets.

@BlakeBarrett
Created December 2, 2014 18:50
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 BlakeBarrett/6f85c911af3d6798310e to your computer and use it in GitHub Desktop.
Save BlakeBarrett/6f85c911af3d6798310e to your computer and use it in GitHub Desktop.
Java / JSON Interview Question
// Find as many errors as possible with this method
/**
* Is the specified user an admin?
*/
public Boolean isUserAdmin(final JSONObject userJson) {
final String userType = userJson.getString("user_type");
if (userType.equals("admin")) {
return true;
} else {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment