Coverage Summary for Class: Atomics (com.google.common.util.concurrent)
| Class | Class, % | Method, % | Line, % |
|---|---|---|---|
| Atomics | 0% (0/1) | 0% (0/5) | 0% (0/5) |
1 /* 2 * Copyright (C) 2010 The Guava Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 * in compliance with the License. You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software distributed under the License 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 * or implied. See the License for the specific language governing permissions and limitations under 12 * the License. 13 */ 14 15 package com.google.common.util.concurrent; 16 17 import com.google.common.annotations.GwtIncompatible; 18 import java.util.concurrent.atomic.AtomicReference; 19 import java.util.concurrent.atomic.AtomicReferenceArray; 20 import org.checkerframework.checker.nullness.qual.Nullable; 21 22 /** 23 * Static utility methods pertaining to classes in the {@code java.util.concurrent.atomic} package. 24 * 25 * @author Kurt Alfred Kluever 26 * @since 10.0 27 */ 28 @GwtIncompatible 29 public final class Atomics { 30 private Atomics() {} 31 32 /** 33 * Creates an {@code AtomicReference} instance with no initial value. 34 * 35 * @return a new {@code AtomicReference} with no initial value 36 */ 37 public static <V> AtomicReference<V> newReference() { 38 return new AtomicReference<V>(); 39 } 40 41 /** 42 * Creates an {@code AtomicReference} instance with the given initial value. 43 * 44 * @param initialValue the initial value 45 * @return a new {@code AtomicReference} with the given initial value 46 */ 47 public static <V> AtomicReference<V> newReference(@Nullable V initialValue) { 48 return new AtomicReference<V>(initialValue); 49 } 50 51 /** 52 * Creates an {@code AtomicReferenceArray} instance of given length. 53 * 54 * @param length the length of the array 55 * @return a new {@code AtomicReferenceArray} with the given length 56 */ 57 public static <E> AtomicReferenceArray<E> newReferenceArray(int length) { 58 return new AtomicReferenceArray<E>(length); 59 } 60 61 /** 62 * Creates an {@code AtomicReferenceArray} instance with the same length as, and all elements 63 * copied from, the given array. 64 * 65 * @param array the array to copy elements from 66 * @return a new {@code AtomicReferenceArray} copied from the given array 67 */ 68 public static <E> AtomicReferenceArray<E> newReferenceArray(E[] array) { 69 return new AtomicReferenceArray<E>(array); 70 } 71 }