Java tutorial
//package com.java2s; import java.util.List; public class Main { /** * Function to check if the mandatory fields are present or not. * @param playerMandatoryFields list of string . * @return true is all are present else will return false */ public static boolean isMandatoryFieldsPresent(List<String> listOfMandatoryFields) { for (int i = 0; i < listOfMandatoryFields.size(); i++) { if (!isValidString(listOfMandatoryFields.get(i))) { return false; } } return true; } /** * Function to validate a string and check if the string is valid or not. * @param string string that need to be validated. * @return true if the string is valid and false if the string is invalid. */ public static boolean isValidString(String string) { return string != null && !string.trim().equalsIgnoreCase("null") && !string.trim().equalsIgnoreCase(""); } }