Skip to content

Commit d339e01

Browse files
Updates
1 parent 2315ca2 commit d339e01

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/main/java/me/flame/menus/menu/iterator/PageIterator.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,15 @@
1111
import java.util.NoSuchElementException;
1212
import java.util.Optional;
1313

14-
public class PageIterator implements Iterator<MenuItem> {
14+
/**
15+
*
16+
* @author FlameyosFlow
17+
* @since 1.4.0
18+
*
19+
* MenuIterator alternative to iterate through Page instead
20+
*/
21+
@SuppressWarnings("unused")
22+
public final class PageIterator implements Iterator<MenuItem> {
1523
@NotNull
1624
private final Page page;
1725

@@ -53,8 +61,7 @@ public PageIterator(int startingRow, int startingCol,
5361
this.direction = direction;
5462
}
5563

56-
public PageIterator(@NotNull IterationDirection direction,
57-
@NotNull Page page) {
64+
public PageIterator(@NotNull IterationDirection direction, @NotNull Page page) {
5865
this.page = page;
5966
this.rows = page.rows();
6067
this.position = Slot.FIRST.copy();
@@ -67,7 +74,7 @@ public PageIterator(@NotNull IterationDirection direction,
6774
* @param emptyOnly a boolean indicating whether to retrieve only empty slots
6875
* @return the next empty slot in the menu, or null if no empty slot is found
6976
*/
70-
public Slot nextSlot(boolean emptyOnly) {
77+
public @Nullable Slot nextSlot(boolean emptyOnly) {
7178
if (!emptyOnly) return nextSlot();
7279

7380
while (true) {
@@ -147,4 +154,4 @@ public Optional<MenuItem> nextOptional() {
147154
if (slot != null) return page.get(slot);
148155
throw new NoSuchElementException(NOTHING_MORE_NEXT_OPTIONAL);
149156
}
150-
}
157+
}

0 commit comments

Comments
 (0)