Class EvictingQueue<E>

java.lang.Object
All Implemented Interfaces:
java.lang.Iterable<E>, java.util.Collection<E>, java.util.Queue<E>

public class EvictingQueue<E>
extends ForwardingQueue<E>
implements java.util.Queue<E>
Author:
Cyrille Le Clerc
  • Constructor Summary

    Constructors
    Constructor Description
    EvictingQueue​(int capacity)  
  • Method Summary

    Modifier and Type Method Description
    boolean add​(E e)  
    boolean addAll​(java.util.Collection<? extends E> c)  
    protected boolean addEvictingIfNeeded​(E e)  
    static <E> EvictingQueue<E> create​(int maxCapacity)  
    protected java.util.Queue<E> delegate()  
    boolean offer​(E e)  

    Methods inherited from class org.jmxtrans.agent.util.collect.ForwardingQueue

    element, peek, poll, remove

    Methods inherited from class org.jmxtrans.agent.util.collect.ForwardingCollection

    clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, standardAddAll, toArray, toArray, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.util.Collection

    clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toArray

    Methods inherited from interface java.lang.Iterable

    forEach

    Methods inherited from interface java.util.Queue

    element, peek, poll, remove
  • Constructor Details

    • EvictingQueue

      public EvictingQueue​(int capacity)
  • Method Details

    • create

      public static <E> EvictingQueue<E> create​(int maxCapacity)
    • delegate

      @Nonnull protected java.util.Queue<E> delegate()
      Specified by:
      delegate in class ForwardingQueue<E>
    • add

      public boolean add​(E e)
      Specified by:
      add in interface java.util.Collection<E>
      Specified by:
      add in interface java.util.Queue<E>
      Overrides:
      add in class ForwardingQueue<E>
    • addAll

      public boolean addAll​(java.util.Collection<? extends E> c)
      Specified by:
      addAll in interface java.util.Collection<E>
      Overrides:
      addAll in class ForwardingCollection<E>
    • offer

      public boolean offer​(E e)
      Specified by:
      offer in interface java.util.Queue<E>
      Overrides:
      offer in class ForwardingQueue<E>
    • addEvictingIfNeeded

      protected boolean addEvictingIfNeeded​(E e)