Interface ScheduledEntries<K,V>

Type Parameters:
K - the scheduled entry key type
V - the scheduled entry value type
All Superinterfaces:
Iterable<Map.Entry<K,V>>

public interface ScheduledEntries<K,V> extends Iterable<Map.Entry<K,V>>
A collection of scheduled entries with a predictable iteration order.
Author:
Paul Ferraro
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(K key, V value)
    Adds an entry using the specified key and value.
    boolean
    contains(K key)
    Indicates whether specified key exists among the scheduled entries.
    boolean
    Indicates whether the entries are sorted, or if iteration order recapitulates insertion order.
    default Iterator<Map.Entry<K,V>>
     
    default Map.Entry<K,V>
    Returns, but does not remove, the first entry.
    static <K,V> ScheduledEntries<K,V>
    Creates a queue-based scheduled entries collection.
    void
    remove(K key)
    Removes the entry with the specified key.
    static <K, V extends Comparable<? super V>>
    ScheduledEntries<K,V>
    Creates a sorted scheduled entries collection.
    static <K, V extends Comparable<? super V>>
    ScheduledEntries<K,V>
    sorted(Comparator<Map.Entry<K,V>> comparator)
    Creates a sorted scheduled entries collection using the specified comparator
    Returns a stream of scheduled entries.

    Methods inherited from interface Iterable

    forEach, spliterator
  • Method Details

    • isSorted

      boolean isSorted()
      Indicates whether the entries are sorted, or if iteration order recapitulates insertion order.
      Returns:
      true, if these entries are sorted, false otherwise.
    • add

      void add(K key, V value)
      Adds an entry using the specified key and value.
      Parameters:
      key - an entry key
      value - an entry value
    • remove

      void remove(K key)
      Removes the entry with the specified key.
      Parameters:
      key - an entry key
    • contains

      boolean contains(K key)
      Indicates whether specified key exists among the scheduled entries.
      Parameters:
      key - an entry key
      Returns:
      true, if the key is a scheduled entry, false otherwise
    • peek

      default Map.Entry<K,V> peek()
      Returns, but does not remove, the first entry.
      Returns:
      the first entry, or null if there are no entries.
    • stream

      Stream<Map.Entry<K,V>> stream()
      Returns a stream of scheduled entries.
      Returns:
      a stream of scheduled entries.
    • iterator

      default Iterator<Map.Entry<K,V>> iterator()
      Specified by:
      iterator in interface Iterable<K>
    • queued

      static <K,V> ScheduledEntries<K,V> queued()
      Creates a queue-based scheduled entries collection.
      Type Parameters:
      K - the entry key type
      V - the entry value type
      Returns:
      a queue-based scheduled entries collection.
    • sorted

      static <K, V extends Comparable<? super V>> ScheduledEntries<K,V> sorted()
      Creates a sorted scheduled entries collection.
      Type Parameters:
      K - the entry key type
      V - the entry value type
      Returns:
      a sorted scheduled entries collection.
    • sorted

      static <K, V extends Comparable<? super V>> ScheduledEntries<K,V> sorted(Comparator<Map.Entry<K,V>> comparator)
      Creates a sorted scheduled entries collection using the specified comparator
      Type Parameters:
      K - the entry key type
      V - the entry value type
      Parameters:
      comparator - an entry comparator
      Returns:
      a sorted scheduled entries collection.