public Account getAccountByName(String accountName) {
    if (accountName != null) {
      for (Account account : getAccounts()) {
        if (accountName.equals(account.name)) {
          return account;
        }
      }
    }
    return null;
  }
public Account getAccountByName ( String accountName ) { if ( accountName != null ) { for ( Account account : getAccounts ( ) ) { if ( accountName . equals ( account . name ) ) { return account ; } } } return null ; }
Returns the Google account of the given {@link Account#name}.

@param accountName Google account name or {@code null} for {@code null} result
@return Google account or {@code null} for none found or for {@code null} input