Package org.javacord.api.entity.message
Interface MessageSet
-
- All Superinterfaces:
Collection<Message>,Iterable<Message>,NavigableSet<Message>,Set<Message>,SortedSet<Message>
public interface MessageSet extends NavigableSet<Message>
This class represents an unmodifiable set of messages that is always sorted from oldest to newest according to the natural ordering ofMessages.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default CompletableFuture<Void>deleteAll()Deletes all messages in this message set at once.default Optional<Message>getNewestMessage()Gets the newest message in the history.default Optional<Message>getOldestMessage()Gets the oldest message in the history.MessageSetheadSet(Message toElement)MessageSetheadSet(Message toElement, boolean inclusive)MessageSetsubSet(Message fromElement, boolean fromInclusive, Message toElement, boolean toInclusive)MessageSetsubSet(Message fromElement, Message toElement)MessageSettailSet(Message fromElement)MessageSettailSet(Message fromElement, boolean inclusive)-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream
-
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 Optional<Message> getOldestMessage()
Gets the oldest message in the history.- Returns:
- The oldest message in the history.
-
getNewestMessage
default Optional<Message> getNewestMessage()
Gets the newest message in the history.- Returns:
- The newest message in the history.
-
deleteAll
default CompletableFuture<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:
subSetin interfaceNavigableSet<Message>
-
subSet
MessageSet subSet(Message fromElement, Message toElement)
-
headSet
MessageSet headSet(Message toElement, boolean inclusive)
- Specified by:
headSetin interfaceNavigableSet<Message>
-
headSet
MessageSet headSet(Message toElement)
-
tailSet
MessageSet tailSet(Message fromElement)
-
tailSet
MessageSet tailSet(Message fromElement, boolean inclusive)
- Specified by:
tailSetin interfaceNavigableSet<Message>
-
-