Code example for ConcurrentHashMap

Methods: containsKey, get

0
 
    public boolean handleCached(Request request, Response response) {
        Cookie c = request.getCookies().getFirst(UserCookieID);
        if (c != null) { // might be in cache
            String key = c.getValue();
            if (key != null && key.length() > 0 && userCache.containsKey(key)) {
                createResponse(userCache.get(key), request, response);
                clearCookies(response);
                return true; 
            } 
        } 
        return false; 
    } 
 
    /** 
     * Converts the given array of bytes to its hexadecimal representation. 
     *  
     * @param input 
     *            The given array of bytes. 
     * @return The converter value as a string of characters. 
     */