Why does Java 8 provide LongAccumulator but not IntAccumulator?
Currently my program makes heavy use of AtomicInteger
to keep track of the execution of maximum int values ββthat are reported in parallel.
After reading about Java 8 new LongAccumulator
s, I was hoping to use IntAccumulator
s max
as an accumulator function to accomplish my desired behavior with less thread conflicts. However, it doesn't seem to exist.
Is there any reason that IntAccumulator
doesn't make sense? It seems plausible to me that there may be low-level instructions that make it unnecessary IntAdder
, but IntAccumulator
may represent more behavior than can be captured by a low-level instruction.
(If it matters at all, I intend to use them from Scala code)
source to share
No one has answered this question yet
Check out similar questions: