Code example for AtomicLong

Methods: getAndIncrement

0
     */ 
 
    public synchronized String generateId() {
        final StringBuilder sb = new StringBuilder(this.length);
        sb.append(this.seed);
        sb.append(this.sequence.getAndIncrement());
        return sb.toString();
    } 
 
 
    /** 
     * Generate a unique ID - that is friendly for a URL or file system 
     *  
     * @return a unique id 
     */ 
    public String generateSanitizedId() {
        String result = this.generateId();
        result = result.replace(':', '-');
        result = result.replace('_', '-');
        result = result.replace('.', '-');
Stop searching for code, let great code find you!  Add Codota to your java IDE