Skip to content

Commit 68ceb6e

Browse files
authored
Add missing Collection overload (#5)
1 parent 3a086dc commit 68ceb6e

File tree

1 file changed

+32
-4
lines changed

1 file changed

+32
-4
lines changed

menu/src/main/java/com/jagrosh/jdautilities/menu/EmbedPaginator.java

+32-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@
2626
import net.dv8tion.jda.api.requests.RestAction;
2727
import net.dv8tion.jda.internal.utils.Checks;
2828

29-
import java.util.Arrays;
30-
import java.util.LinkedList;
31-
import java.util.List;
32-
import java.util.Set;
29+
import java.util.*;
3330
import java.util.concurrent.TimeUnit;
3431
import java.util.function.BiFunction;
3532
import java.util.function.Consumer;
@@ -453,6 +450,21 @@ public Builder addItems(MessageEmbed... embeds)
453450
this.embeds.addAll(Arrays.asList(embeds));
454451
return this;
455452
}
453+
454+
/**
455+
* Adds the collection of provided {@link net.dv8tion.jda.api.entities.MessageEmbed MessageEmbeds} to the list
456+
* of items to paginate.
457+
*
458+
* @param embeds
459+
* The collection of MessageEmbeds to add
460+
*
461+
* @return This builder
462+
*/
463+
public Builder addItems(Collection<MessageEmbed> embeds)
464+
{
465+
this.embeds.addAll(embeds);
466+
return this;
467+
}
456468

457469
/**
458470
* Adds {@link net.dv8tion.jda.api.entities.MessageEmbed MessageEmbeds} to the list of items to paginate.
@@ -494,6 +506,22 @@ public Builder setItems(MessageEmbed... embeds)
494506
return this;
495507
}
496508

509+
/**
510+
* Sets the {@link net.dv8tion.jda.api.entities.MessageEmbed MessageEmbeds} to paginate.
511+
* <br>This method clears all previously set items before adding the provided collection of MessageEmbeds.
512+
*
513+
* @param embeds
514+
* The collection of MessageEmbeds to set.
515+
*
516+
* @return This builder
517+
*/
518+
public Builder setItems(Collection<MessageEmbed> embeds)
519+
{
520+
this.embeds.clear();
521+
addItems(embeds);
522+
return this;
523+
}
524+
497525
/**
498526
* Sets the {@link net.dv8tion.jda.api.entities.MessageEmbed MessageEmbeds} to paginate.
499527
* <br>This method clears all previously set items before setting each String as a new MessageEmbed.

0 commit comments

Comments
 (0)