-
Notifications
You must be signed in to change notification settings - Fork 109
Expand file tree
/
Copy pathDeviceListIterator.java
More file actions
53 lines (45 loc) · 1.01 KB
/
DeviceListIterator.java
File metadata and controls
53 lines (45 loc) · 1.01 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) 2013 Klaus Reimer <[email protected]>
* See LICENSE.md for licensing information.
*/
package org.usb4java;
import java.util.Iterator;
import java.util.NoSuchElementException;
/**
* Iterator for device list.
*
* @author Klaus Reimer ([email protected])
*/
final class DeviceListIterator implements Iterator<Device>
{
/** The devices list. */
private final DeviceList devices;
/** The current index. */
private int nextIndex;
/**
* Constructor.
*
* @param devices
* The devices list.
*/
DeviceListIterator(final DeviceList devices)
{
this.devices = devices;
}
@Override
public boolean hasNext()
{
return this.nextIndex < this.devices.getSize();
}
@Override
public Device next()
{
if (!hasNext()) throw new NoSuchElementException();
return this.devices.get(this.nextIndex++);
}
@Override
public void remove()
{
throw new UnsupportedOperationException();
}
}