org.apache.ignite.internal.util.lang.gridfunc

## Class AlwaysTrueReducer<T>

- java.lang.Object
- - org.apache.ignite.internal.util.lang.gridfunc.AlwaysTrueReducer<T>

Type Parameters:
  `T` - Reducer element type.

All Implemented Interfaces:
  Serializable, IgniteReducer<T,T>

    public class AlwaysTrueReducer<T>
    extends Object
    implements IgniteReducer<T,T>

Reducer which always returns `true` from `IgniteReducer.collect(Object)`

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`AlwaysTrueReducer(T elem)`

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `collect(T e)` Collects given value.
`T` `reduce()` Reduces collected values into one.
`String` `toString()`

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

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

### Constructor Detail

#### AlwaysTrueReducer

    public AlwaysTrueReducer(T elem)

Parameters:
  `elem` - Element to return from `IgniteReducer.reduce()` method.

### Method Detail

#### collect

    public boolean collect(T e)

Collects given value. If this method returns `false` then `IgniteReducer.reduce()` will be called right away. Otherwise caller will continue collecting until all values are processed.

Specified by:
  `collect` in interface `IgniteReducer<T,T>`
Parameters:
  `e` - Value to collect.
Returns:
  `true` to continue collecting, `false` to instruct caller to stop collecting and call `IgniteReducer.reduce()` method.

#### reduce

    public T reduce()

Reduces collected values into one.

Specified by:
  `reduce` in interface `IgniteReducer<T,T>`
Returns:
  Reduced value.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.8.0
Release Date | : February 27 2020