Atomic Variables Flashcards

1
Q

Atomically updatable boolean value.

A

java.util.concurrent.atomic.AtomicBoolean

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Atomically updatable int value, extends Number class

A

java.util.concurrent.atomic.AtomicInteger

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

An int array in which elements can be updated atomically.

A

java.util.concurrent.atomic.AtomicIntegerArray

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Atomically updatable long value, extends Number class.

A

java.util.concurrent.atomic.AtomicLong

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

A long array in which elements can be updated atomically.

A

java.util.concurrent.atomic.AtomicLongArray

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

An atomically updatable object reference of type V

A

java.util.concurrent.atomic.AtomicReference

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

An atomically updatabale object array that can hold references of type E.

A

java.util.concurrent.atomic.AtomicReferenceArray

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Constructor that creates an instance of AtomicInteger with initial value 0.

A

AtomicInteger()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Overloaded constructor of AtomicInteger that creates it with an initial value set by initVal

A

AtomicInteger(int initVal)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Returns the value held by the object.

A

int get()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Resets the integer value held in this object to newVal.

A

void set(int newVal)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Returns the current int value held in this object and sets the value held in this object to newVal.

A

int getAndSet(int newValue)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Compares the int value of this object to the expect value, and if they are equal, sets the int value of this object to the update value.

A

boolean compareAndSet(int expect, int update)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Returns the current value of the integer value in this object and increments the integer value in this object. Atomic version of i++.

A

int getAndIncrement()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Returns the current value of the integer value in this object and decrements the integer value in this object. Atomic version of iā€“

A

int getAndDecrement()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Returns the integer value held in this object and adds given delta value to the integer value.

A

int getAndAdd(int delta)

17
Q

Increments the current value of the integer value in this object and returns that value. Atomic version of ++i.

A

int incrementAndGet()

18
Q

Decrements the current integer value in this object and returns that value. Atomic version of ā€“i.

A

int decrementAndGet()

19
Q

Adds the delta value to the current value of integer in this object and returns that value.

A

int addAndGet(int delta)

20
Q

Casts the current int value of the object and returns it as int, long, float or double values.

A

int XXXvalue() where XXX is int, float, long or double.