Code example for LinkedBlockingDeque

Methods: peekLast

0
 
    private LinkedBlockingDeque<String> getFifo(String fifoName) {
        if (super.containsKey(fifoName)) {
            return super.get(fifoName);
        } else { 
            LinkedBlockingDeque<String> fifo = new LinkedBlockingDeque<String>();
            super.put(fifoName, fifo);
            return fifo;
        } 
    } 
 
    public String get(String fifoName) {
        LinkedBlockingDeque<String> fifo = getFifo(fifoName);
        String value = fifo.peekLast();
        return value == null ? "" : value;
    } 
 
    public String pop(String fifoName, long timeout) throws InterruptedException {
        LinkedBlockingDeque<String> fifo = getFifo(fifoName);
        final String value = fifo.pollLast(timeout, TimeUnit.SECONDS);
Connect your IDE to all the code out there  Get Codota for Java