There's more...

Nowadays, Java provides another atomic array class. It's called the AtomicLongArray class and it provides the same methods as the IntegerAtomicArray class.

Other interesting methods provided by these classes are:

  • get(int i): Returns the value of the array position specified by the parameter
  • set(int I, int newValue): Establishes the value of the array position specified by the parameter.

Get Java 9 Concurrency Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.