Java AtomicLong isAtomicLong(final N number)

Here you can find the source of isAtomicLong(final N number)

Description

Check if the number is an AtomicLong

License

Apache License

Parameter

Parameter Description
number The number to check
N The type of the number

Return

true, if matches

Declaration

public static <N extends Number> boolean isAtomicLong(final N number) 

Method Source Code

//package com.java2s;
/*/*from   w w  w  .j  a v a  2s  . c o m*/
 * #%L
 * utils-commons
 * %%
 * Copyright (C) 2016 - 2018 Gilles Landel
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

import java.util.concurrent.atomic.AtomicLong;

public class Main {
    /**
     * Check if the number is an {@link AtomicLong}
     * 
     * @param number
     *            The number to check
     * @param <N>
     *            The type of the number
     * @return true, if matches
     */
    public static <N extends Number> boolean isAtomicLong(final N number) {
        return isNumberType(number, AtomicLong.class);
    }

    private static <N extends Number> boolean isNumberType(final N number,
            final Class<? extends Number> classNumber) {
        return number != null && classNumber.isAssignableFrom(number.getClass());
    }
}

Related

  1. getTempDirName()
  2. getTomorrowTime()
  3. getTrackedAllocationStatus()
  4. getUniqueURIString()
  5. greaterAndSet(long value, AtomicLong atomicValue)
  6. joinThreads()
  7. lock()
  8. max(AtomicLong x, long y)
  9. nanoTime()