All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.pixel.commons.util.HashUtils Maven / Gradle / Ivy

The newest version!
/*
 * This software is available under Apache License
 * Copyright (c) 2020
 */

package org.pixel.commons.util;

import java.util.concurrent.atomic.AtomicLong;

public class HashUtils {

    //region private properties

    private static final String UID_PREFIX = "px-";
    private static final AtomicLong uid = new AtomicLong(0);

    //endregion

    //region public static methods

    /**
     * Generate a unique identification value
     *
     * @return
     */
    public static String generateUID() {
        return UID_PREFIX + uid.incrementAndGet();
    }

    /**
     * Generate a numeric unique identification value
     *
     * @return
     */
    public static long generateNumericUID() {
        return uid.incrementAndGet();
    }

    //endregion
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy