I was going through events in solidity and how to catch them in my web3J (web3 java), my requirement was to get all the latest transaction that is being added in the blocks, for that from the documentation I came across transaction observable. The code is as under
Observable<BigInteger> transactionValue = web3j.transactionObservable() .take(COUNT) .map(Transaction::getValue) .reduce(BigInteger.ZERO, BigInteger::add);
Understanding so far: transactionValue is observable for getting notified for all the new transaction that is being added in blocks throughout the network, take operator only take first COUNT transaction, map operator map the result to only transaction value , but I don't have any idea what reduce is doing here?
Can any one explain that?