Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2015-2016 Oak Ridge National Laboratory.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/

public class Main {
    /** @param text Text that should contain true or false
     *  @param default_value Value to use when text is empty
     *  @return Boolean value of text
     */
    public static boolean parseBoolean(final String text, final boolean default_value) {
        if (text == null || text.isEmpty())
            return default_value;
        return Boolean.parseBoolean(text);
    }
}