lmw
2023-03-11 4df5bb59e5fe9f9d140e5610f7772dd8a05a28d4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.beloo.widget.chipslayoutmanager.layouter;
 
 
import androidx.annotation.IntRange;
 
import java.util.Iterator;
 
public abstract class AbstractPositionIterator implements Iterator<Integer> {
    int pos;
    int itemCount;
 
    AbstractPositionIterator(@IntRange(from = 0) int itemCount) {
        if (itemCount < 0) throw new IllegalArgumentException("item count couldn't be negative");
        this.itemCount = itemCount;
    }
 
    public void move(@IntRange(from = 0) int pos) {
        if (pos >= itemCount) throw new IllegalArgumentException("you can't move above of maxItemCount");
        if (pos < 0) throw new IllegalArgumentException("can't move to negative position");
        this.pos = pos;
    }
 
    @Override
    public void remove() {
        throw new UnsupportedOperationException("removing not supported in position iterator");
    }
}