public static String generateUuid ( String ... extraData ) { String extra = null ; if ( extraData != null && extraData . length > 0 ) { final ArrayList < String > extraStrings = new ArrayList <> ( extraData . length ) ; for ( String extraString : extraData ) { if ( ! Strings . isNullOrEmpty ( extraString ) ) { extraStrings . add ( extraString ) ; } } if ( ! extraStrings . isEmpty ( ) ) { extra = Joiner . on ( UUID_DELIM ) . join ( extraStrings ) ; } } // We don't use "-" in general, so remove them here. final String uuid = StringUtils . removeChar ( UUID . randomUUID ( ) . toString ( ) , ' ' ) ; return extra == null ? uuid : ( extra + UUID_DELIM + uuid ) ; }
Generates a universally unique identifier .