/** * Whether this MessageHistory instance has retrieved any messages. * * @return True, If this MessageHistory instance has not retrieved any messages from discord. */ public boolean isEmpty() { return size() == 0; }
/** * Returns a List of Messages, sorted starting from newest to oldest, of all message that have already been retrieved * from Discord with this MessageHistory object using the {@link #retrievePast(int)}, {@link #retrieveFuture(int)}, and * {@link net.dv8tion.jda.core.entities.MessageChannel#getHistoryAround(String, int)} methods. * * @return A List of Messages, sorted newest to oldest. */ public List<Message> getRetrievedHistory() { int size = size(); if (size == 0) return Collections.emptyList(); else if (size == 1) return Collections.singletonList(history.getValue(0)); return Collections.unmodifiableList(new ArrayList<>(history.values())); }