Class ApproximatePriorityQueue<T>


  • final class ApproximatePriorityQueue<T>
    extends java.lang.Object
    An approximate priority queue, which attempts to poll items by decreasing log of the weight, though exact ordering is not guaranteed. This class doesn't support null elements.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.List<T> slots  
      private long usedSlots  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void add​(T entry, long weight)
      Add an entry to this queue that has the provided weight.
      (package private) boolean contains​(java.lang.Object o)  
      (package private) boolean isEmpty()  
      (package private) T poll​(java.util.function.Predicate<T> predicate)
      Return an entry matching the predicate.
      (package private) boolean remove​(java.lang.Object o)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • slots

        private final java.util.List<T> slots
      • usedSlots

        private long usedSlots
    • Constructor Detail

      • ApproximatePriorityQueue

        ApproximatePriorityQueue()
    • Method Detail

      • add

        void add​(T entry,
                 long weight)
        Add an entry to this queue that has the provided weight.
      • poll

        T poll​(java.util.function.Predicate<T> predicate)
        Return an entry matching the predicate. This will usually be one of the available entries that have the highest weight, though this is not guaranteed. This method returns null if no free entries are available.
      • contains

        boolean contains​(java.lang.Object o)
      • isEmpty

        boolean isEmpty()
      • remove

        boolean remove​(java.lang.Object o)