com.alexkasko.unsafe.offheaplong
class OffHeapLongIterator extends Object implements OffHeapDisposableIterator<Long>
Iterator implementation for unsafe long collections. Underneath collection size will be remembered once on iterator creation.
Note: iterator will create new autoboxed Long object on every next() call,
this behaviour is inevitable with iterators in java 6/7.
| Modifier and Type | Field and Description |
|---|---|
private OffHeapLongAddressable |
data |
private long |
index |
private long |
size |
| Constructor and Description |
|---|
OffHeapLongIterator(OffHeapLongAddressable data)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
free()
Frees allocated memory, may be called multiple times from any thread
|
boolean |
hasNext() |
Long |
next() |
void |
remove()
Remove operation is not supported
|
long |
size()
Optional method, should return size of the underlying collections,
if such size is known on iterator creation or
-1 otherwise |
String |
toString() |
private final OffHeapLongAddressable data
private final long size
private long index
OffHeapLongIterator(OffHeapLongAddressable data)
data - offheap long collectionpublic void remove()
remove in interface Iterator<Long>UnsupportedOperationExceptionpublic long size()
-1 otherwisesize in interface OffHeapDisposableIterator<Long>public void free()
free in interface OffHeapDisposableCopyright © 2014. All Rights Reserved.