get boolean value from java.lang.Integer, skip null value - Android java.lang

Android examples for java.lang:Boolean

Description

get boolean value from java.lang.Integer, skip null value

Demo Code

/*//  ww w .  ja v a2 s .c om
 * File: $RCSfile: ObjectUtilities.java,v $
 *
 * Copyright (c) 2009 Kewill,
 *
 * All Rights Reserved.
 *
 * This software is the confidential and proprietary information
 * of Kewill ("Confidential Information"). You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered
 * into with Kewill.
 */
//package com.java2s;

public class Main {
    /**
     * get boolean value from <code>java.lang.Integer</code>, skip null value
     *
     * @param value <code>java.lang.Integer</code>
     * @return if value if null or its value is 0 return false, else return true
     */
    public static boolean booleanValueForInteger(Integer value) {
        return value != null && value == 1;
    }
}

Related Tutorials