com.hazelcast.ringbuffer
Interface ReadResultSet<E>

Type Parameters:
E -
All Superinterfaces:
Iterable<E>
All Known Implementing Classes:
ReadResultSetImpl

@Beta
public interface ReadResultSet<E>
extends Iterable<E>

The result of a Ringbuffer.readManyAsync(long, int, int, com.hazelcast.core.IFunction) operation. Important: If an item is retrieved multiple times from the result set, a new instance is returned for every invocation. This is done to prevent unexpected sharing if the ICompletableFuture is shared between multiple threads.


Method Summary
 E get(int index)
          Gets the item at the given index.
 int readCount()
          Returns the number of items that have been read before filtering.
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

readCount

int readCount()
Returns the number of items that have been read before filtering. If no filter is set, then the readCount will be the same as size. But if a filter is applied, it could be that items are read, but are filtered out. So if you are trying to make another read based on the ReadResultSet then you should increment the sequence by readCount and not by size. Otherwise you will be re-reading the same filtered messages.

Returns:
the number of items read (including the filtered ones).

get

E get(int index)
Gets the item at the given index.

Parameters:
index - the index
Returns:
the found item.
Throws:
IllegalArgumentException - if index out of bounds.


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.