Interface MessageSet

  • All Superinterfaces:
    java.util.Collection<Message>, java.lang.Iterable<Message>, java.util.NavigableSet<Message>, java.util.Set<Message>, java.util.SortedSet<Message>

    public interface MessageSet
    extends java.util.NavigableSet<Message>
    This class represents an unmodifiable set of messages that is always sorted from oldest to newest according to the natural ordering of Messages.
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default java.util.concurrent.CompletableFuture<java.lang.Void> deleteAll()
      Deletes all messages in this message set at once.
      default java.util.Optional<Message> getNewestMessage()
      Gets the newest message in the history.
      default java.util.Optional<Message> getOldestMessage()
      Gets the oldest message in the history.
      MessageSet headSet​(Message toElement)  
      MessageSet headSet​(Message toElement, boolean inclusive)  
      MessageSet subSet​(Message fromElement, boolean fromInclusive, Message toElement, boolean toInclusive)  
      MessageSet subSet​(Message fromElement, Message toElement)  
      MessageSet tailSet​(Message fromElement)  
      MessageSet tailSet​(Message fromElement, boolean inclusive)  
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.NavigableSet

        ceiling, descendingIterator, descendingSet, floor, higher, iterator, lower, pollFirst, pollLast
      • Methods inherited from interface java.util.Set

        add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, size, toArray, toArray
      • Methods inherited from interface java.util.SortedSet

        comparator, first, last, spliterator
    • Method Detail

      • getOldestMessage

        default java.util.Optional<Message> getOldestMessage()
        Gets the oldest message in the history.
        Returns:
        The oldest message in the history.
      • getNewestMessage

        default java.util.Optional<Message> getNewestMessage()
        Gets the newest message in the history.
        Returns:
        The newest message in the history.
      • deleteAll

        default java.util.concurrent.CompletableFuture<java.lang.Void> deleteAll()
        Deletes all messages in this message set at once. This method does not have a size or age restriction. Messages younger than two weeks are sent in batches of 100 messages to the bulk delete API, older messages are deleted with individual delete requests.
        Returns:
        A future to tell us if the deletion was successful.
      • subSet

        MessageSet subSet​(Message fromElement,
                          boolean fromInclusive,
                          Message toElement,
                          boolean toInclusive)
        Specified by:
        subSet in interface java.util.NavigableSet<Message>
      • subSet

        MessageSet subSet​(Message fromElement,
                          Message toElement)
        Specified by:
        subSet in interface java.util.NavigableSet<Message>
        Specified by:
        subSet in interface java.util.SortedSet<Message>
      • headSet

        MessageSet headSet​(Message toElement,
                           boolean inclusive)
        Specified by:
        headSet in interface java.util.NavigableSet<Message>
      • headSet

        MessageSet headSet​(Message toElement)
        Specified by:
        headSet in interface java.util.NavigableSet<Message>
        Specified by:
        headSet in interface java.util.SortedSet<Message>
      • tailSet

        MessageSet tailSet​(Message fromElement)
        Specified by:
        tailSet in interface java.util.NavigableSet<Message>
        Specified by:
        tailSet in interface java.util.SortedSet<Message>
      • tailSet

        MessageSet tailSet​(Message fromElement,
                           boolean inclusive)
        Specified by:
        tailSet in interface java.util.NavigableSet<Message>