According to Javadoc , HttpServletRequest.getCookies() "Returns an array containing all the cookies sent by the client with this request." And it returns null if no cookies were sent.
Is there any specific reason for this behavior other than returning an empty array, which seems more intuitive to me and avoids having to check for null before iterating through the array to find a specific cookie?
source share