1 *java.util.concurrent.atomic.AtomicInteger* *AtomicInteger* An int value that ma
3 public class AtomicInteger
4 extends |java.lang.Number|
5 implements |java.io.Serializable|
7 |java.util.concurrent.atomic.AtomicInteger_Description|
8 |java.util.concurrent.atomic.AtomicInteger_Fields|
9 |java.util.concurrent.atomic.AtomicInteger_Constructors|
10 |java.util.concurrent.atomic.AtomicInteger_Methods|
12 ================================================================================
14 *java.util.concurrent.atomic.AtomicInteger_Constructors*
15 |java.util.concurrent.atomic.AtomicInteger()|Create a new AtomicInteger with in
16 |java.util.concurrent.atomic.AtomicInteger(int)|Create a new AtomicInteger with
18 *java.util.concurrent.atomic.AtomicInteger_Methods*
19 |java.util.concurrent.atomic.AtomicInteger.addAndGet(int)|Atomically add the gi
20 |java.util.concurrent.atomic.AtomicInteger.compareAndSet(int,int)|Atomically se
21 |java.util.concurrent.atomic.AtomicInteger.decrementAndGet()|Atomically decreme
22 |java.util.concurrent.atomic.AtomicInteger.doubleValue()|
23 |java.util.concurrent.atomic.AtomicInteger.floatValue()|
24 |java.util.concurrent.atomic.AtomicInteger.get()|Get the current value.
25 |java.util.concurrent.atomic.AtomicInteger.getAndAdd(int)|Atomically add the gi
26 |java.util.concurrent.atomic.AtomicInteger.getAndDecrement()|Atomically decreme
27 |java.util.concurrent.atomic.AtomicInteger.getAndIncrement()|Atomically increme
28 |java.util.concurrent.atomic.AtomicInteger.getAndSet(int)|Set to the give value
29 |java.util.concurrent.atomic.AtomicInteger.incrementAndGet()|Atomically increme
30 |java.util.concurrent.atomic.AtomicInteger.intValue()|
31 |java.util.concurrent.atomic.AtomicInteger.longValue()|
32 |java.util.concurrent.atomic.AtomicInteger.set(int)|Set to the given value.
33 |java.util.concurrent.atomic.AtomicInteger.toString()|Returns the String repres
34 |java.util.concurrent.atomic.AtomicInteger.weakCompareAndSet(int,int)|Atomicall
36 *java.util.concurrent.atomic.AtomicInteger_Description*
38 An int value that may be updated atomically. See the
39 (|java.util.concurrent.atomic|) package specification for description of the
40 properties of atomic variables. An AtomicInteger is used in applications such
41 as atomically incremented counters, and cannot be used as a replacement for an
42 (|java.lang.Integer|) . However, this class does extend Number to allow uniform
43 access by tools and utilities that deal with numerically-based classes.
46 *java.util.concurrent.atomic.AtomicInteger()*
48 public AtomicInteger()
50 Create a new AtomicInteger with initial value 0.
53 *java.util.concurrent.atomic.AtomicInteger(int)*
55 public AtomicInteger(int initialValue)
57 Create a new AtomicInteger with the given initial value.
59 initialValue - the initial value
61 *java.util.concurrent.atomic.AtomicInteger.addAndGet(int)*
63 public final int addAndGet(int delta)
65 Atomically add the given value to current value.
67 delta - the value to add
69 Returns: the updated value
70 *java.util.concurrent.atomic.AtomicInteger.compareAndSet(int,int)*
72 public final boolean compareAndSet(
76 Atomically set the value to the given updated value if the current value == the
79 expect - the expected value
80 update - the new value
82 Returns: true if successful. False return indicates that the actual value was not equal
83 to the expected value.
84 *java.util.concurrent.atomic.AtomicInteger.decrementAndGet()*
86 public final int decrementAndGet()
88 Atomically decrement by one the current value.
91 Returns: the updated value
92 *java.util.concurrent.atomic.AtomicInteger.doubleValue()*
94 public double doubleValue()
99 *java.util.concurrent.atomic.AtomicInteger.floatValue()*
101 public float floatValue()
106 *java.util.concurrent.atomic.AtomicInteger.get()*
108 public final int get()
110 Get the current value.
113 Returns: the current value
114 *java.util.concurrent.atomic.AtomicInteger.getAndAdd(int)*
116 public final int getAndAdd(int delta)
118 Atomically add the given value to current value.
120 delta - the value to add
122 Returns: the previous value
123 *java.util.concurrent.atomic.AtomicInteger.getAndDecrement()*
125 public final int getAndDecrement()
127 Atomically decrement by one the current value.
130 Returns: the previous value
131 *java.util.concurrent.atomic.AtomicInteger.getAndIncrement()*
133 public final int getAndIncrement()
135 Atomically increment by one the current value.
138 Returns: the previous value
139 *java.util.concurrent.atomic.AtomicInteger.getAndSet(int)*
141 public final int getAndSet(int newValue)
143 Set to the give value and return the old value.
145 newValue - the new value
147 Returns: the previous value
148 *java.util.concurrent.atomic.AtomicInteger.incrementAndGet()*
150 public final int incrementAndGet()
152 Atomically increment by one the current value.
155 Returns: the updated value
156 *java.util.concurrent.atomic.AtomicInteger.intValue()*
158 public int intValue()
163 *java.util.concurrent.atomic.AtomicInteger.longValue()*
165 public long longValue()
170 *java.util.concurrent.atomic.AtomicInteger.set(int)*
172 public final void set(int newValue)
174 Set to the given value.
176 newValue - the new value
178 *java.util.concurrent.atomic.AtomicInteger.toString()*
180 public |java.lang.String| toString()
182 Returns the String representation of the current value.
185 Returns: the String representation of the current value.
186 *java.util.concurrent.atomic.AtomicInteger.weakCompareAndSet(int,int)*
188 public final boolean weakCompareAndSet(
192 Atomically set the value to the given updated value if the current value == the
193 expected value. May fail spuriously.
195 expect - the expected value
196 update - the new value
198 Returns: true if successful.