Ensure null checks follow consistent patterns and proper ordering for better readability and safety. Always place the variable being checked on the left side of null comparisons, use defensive programming with hasKey() checks before accessing map values, and maintain null-safe fallbacks when appropriate.

Key practices:

Example:

// Good: Consistent ordering and defensive programming
if (!action.hasKey("name") || !action.hasKey("label")) {
  throw new IllegalArgumentException("Unknown accessibility action.");
}
String actionLabel = action.hasKey("label") ? action.getString("label") : null;

// Good: Proper null check ordering
if (!mSendMomentumEvents || mPostSmoothScrollRunnable != null) {
  return;
}

// Avoid: Inconsistent null check ordering
if (!mSendMomentumEvents || null != mPostSmoothScrollRunnable) {
  return;
}