Java Number Sum sumIf(final Integer number, final Integer sum, final Boolean condition)

Here you can find the source of sumIf(final Integer number, final Integer sum, final Boolean condition)

Description

sum If

License

Apache License

Declaration

public static int sumIf(final Integer number, final Integer sum, final Boolean condition) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static int sumIf(final Integer number, final Integer sum, final Boolean condition) {
        int result = number != null ? number : 0;
        if (Boolean.TRUE.equals(condition) && sum != null) {
            result += sum;/*from   w  w  w  .  j a v  a 2s. c o  m*/
        }
        return result;
    }
}

Related

  1. sumFirstNDivisibleByM(long n, long m)
  2. sumFromNtoM(int n, int m)
  3. sumHadOverflow(long a, long b, long sum)
  4. sumHash(int hash, String element)
  5. sumHash(int leftHash, int rightHash)
  6. sumIsMod10(int sum)
  7. sumLange(int _a, int _b)
  8. sumLogProb(double a, double b)
  9. summarize(String longString, int limit)