/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

import java.util.stream.* ;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{

        String productId = null;
        String productAltID = null;
        Date productSellDate = new Date();
        Date productReturnDate = new Date() ;

		boolean atLeastOneIdHasValue = Stream.of( productId , productAltID ).anyMatch( Objects :: nonNull ) ;  // One or more ID fields have a value.
		boolean bothDatesHaveValue = Stream.of( productSellDate , productReturnDate ).allMatch( Objects :: nonNull ) ;  // All dates have a value.
		boolean valid = ( atLeastOneIdHasValue || bothDatesHaveValue ) ;
		
		System.out.println( "valid: " + valid ) ;
	}
}