Here you can find the source of isLocalTimeInRange(LocalTime value, LocalTime optionalMinimum, LocalTime optionalMaximum, boolean inclusiveOfEndpoints)
public static boolean isLocalTimeInRange(LocalTime value, LocalTime optionalMinimum, LocalTime optionalMaximum, boolean inclusiveOfEndpoints)
//package com.java2s; //License from project: Open Source License import java.time.*; public class Main { /**// w w w .j ava 2s.c o m * isLocalTimeInRange, This returns true if the specified value is inside of the specified * range. This returns false if the specified value is outside of the specified range. If the * specified value is null, then this will return false. * * If optionalMinimum is null, then it will be set to LocalTime.MIN. If optionalMaximum is null, * then it will be set to LocalTime.MAX. * * If inclusiveOfEndpoints is true, then values that equal the minimum or maximum will return * true. Otherwise, values that equal the minimum or maximum will return false. */ public static boolean isLocalTimeInRange(LocalTime value, LocalTime optionalMinimum, LocalTime optionalMaximum, boolean inclusiveOfEndpoints) { // If either bounding time does does not already exist, then set it to the maximum range. LocalTime minimum = (optionalMinimum == null) ? LocalTime.MIN : optionalMinimum; LocalTime maximum = (optionalMaximum == null) ? LocalTime.MAX : optionalMaximum; // Null is never considered to be inside of a range. if (value == null) { return false; } // Return false if the range does not contain any times. if (maximum.isBefore(minimum) || maximum.equals(minimum)) { return false; } if (inclusiveOfEndpoints) { return ((value.isAfter(minimum) || value.equals(minimum)) && (value.isBefore(maximum) || value.equals(maximum))); } else { return (value.isAfter(minimum) && value.isBefore(maximum)); } } }