mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2024-11-19 09:50:32 +01:00
Transaction: use stream in method getOutputSum()
This commit is contained in:
parent
9de77cdd67
commit
7cb61b0399
@ -500,13 +500,9 @@ public class Transaction extends BaseMessage {
|
||||
* @return the sum of the outputs regardless of who owns them.
|
||||
*/
|
||||
public Coin getOutputSum() {
|
||||
Coin totalOut = Coin.ZERO;
|
||||
|
||||
for (TransactionOutput output: outputs) {
|
||||
totalOut = totalOut.add(output.getValue());
|
||||
}
|
||||
|
||||
return totalOut;
|
||||
return outputs.stream()
|
||||
.map(TransactionOutput::getValue)
|
||||
.reduce(Coin.ZERO, Coin::add);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user