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

io.github.wj0410.cloudbox.tools.util.uuid.IdUtils Maven / Gradle / Ivy

The newest version!
package io.github.wj0410.cloudbox.tools.util.uuid;

/**
 * ID生成器工具类
 *
 * @author wangjie
 */
public class IdUtils {
    /**
     * 获取随机UUID
     *
     * @return 随机UUID
     */
    public static String randomUUID() {
        return UUID.randomUUID().toString();
    }

    /**
     * 简化的UUID,去掉了横线
     *
     * @return 简化的UUID,去掉了横线
     */
    public static String simpleUUID() {
        return UUID.randomUUID().toString(true);
    }

    /**
     * 获取随机UUID,使用性能更好的ThreadLocalRandom生成UUID
     *
     * @return 随机UUID
     */
    public static String fastUUID() {
        return UUID.fastUUID().toString();
    }

    /**
     * 简化的UUID,去掉了横线,使用性能更好的ThreadLocalRandom生成UUID
     *
     * @return 简化的UUID,去掉了横线
     */
    public static String fastSimpleUUID() {
        return UUID.fastUUID().toString(true);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy