org.apache.ignite.stream

## Class StreamVisitor<K,V>

- java.lang.Object
- - org.apache.ignite.stream.StreamVisitor<K,V>

All Implemented Interfaces:
  Serializable, IgniteBiInClosure<IgniteCache<K,V>,Map.Entry<K,V>>, StreamReceiver<K,V>

    public abstract class StreamVisitor<K,V>
    extends Object
    implements StreamReceiver<K,V>, IgniteBiInClosure<IgniteCache<K,V>,Map.Entry<K,V>>

Convenience adapter to visit every key-value tuple in the stream. Note, that the visitor does not update the cache. If the tuple needs to be stored in the cache, then `cache.put(...)` should be called explicitly.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`StreamVisitor()`

### Method Summary

Methods
`static <K,V> StreamVisitor<K,V>` `from(IgniteBiInClosure<IgniteCache<K,V>,Map.Entry<K,V>> c)` Creates a new visitor based on instance of `IgniteBiInClosure`.
`void` `receive(IgniteCache<K,V> cache, Collection<Map.Entry<K,V>> entries)` Updates cache with batch of entries.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.apache.ignite.lang.IgniteBiInClosure

`apply`

### Constructor Detail

#### StreamVisitor

    public StreamVisitor()

### Method Detail

#### receive

    public void receive(IgniteCache<K,V> cache,
               Collection<Map.Entry<K,V>> entries)
                 throws IgniteException

Updates cache with batch of entries.

Specified by:
  `receive` in interface `StreamReceiver<K,V>`
Parameters:
  `cache` - Cache.
  `entries` - Collection of entries.
Throws:
  `IgniteException` - If failed.

#### from

    public static <K,V> StreamVisitor<K,V> from(IgniteBiInClosure<IgniteCache<K,V>,Map.Entry<K,V>> c)

Creates a new visitor based on instance of `IgniteBiInClosure`.

Parameters:
  `c` - Closure.
Returns:
  Stream visitor.

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.9.0
Release Date | : March 2 2017