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)

+3
java scala concurrency compare-and-swap


source to share


No one has answered this question yet

Check out similar questions:

23498
Why is processing a sorted array faster than processing an unsorted array?
6549
Why subtracting these two times (in 1927) gives a strange result?
6170
Is Java "pass-by-reference" or "pass-by-value"?
3799
How do I read / convert an InputStream to a string in Java?
3486
Why Java + =, - =, * =, / = do not require casting assignment operators?
3324
How to generate random integers in a specific range in Java?
3156
Why is char [] preferred over String for passwords?
3044
Making a memory leak with Java
2248
Is a finally block always executable in Java?
1338
Why does Java have transient fields?



All Articles
Loading...
X
Show
Funny
Dev
Pics