-
Notifications
You must be signed in to change notification settings - Fork 108
Expand file tree
/
Copy pathPollfdsIterator.java
More file actions
53 lines (45 loc) · 1.02 KB
/
PollfdsIterator.java
File metadata and controls
53 lines (45 loc) · 1.02 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* Copyright (C) 2018 Klaus Reimer <[email protected]>
* See LICENSE.md for licensing information.
*/
package org.usb4java;
import java.util.Iterator;
import java.util.NoSuchElementException;
/**
* Iterator for {@link Pollfds}.
*
* @author Klaus Reimer ([email protected])
*/
final class PollfdsIterator implements Iterator<Pollfd>
{
/** The file descriptor list. */
private final Pollfds pollfds;
/** The current index. */
private int nextIndex;
/**
* Constructor.
*
* @param pollfds
* The file descriptor list list.
*/
PollfdsIterator(final Pollfds pollfds)
{
this.pollfds = pollfds;
}
@Override
public boolean hasNext()
{
return this.nextIndex < this.pollfds.getSize();
}
@Override
public Pollfd next()
{
if (!hasNext()) throw new NoSuchElementException();
return this.pollfds.get(this.nextIndex++);
}
@Override
public void remove()
{
throw new UnsupportedOperationException();
}
}