1 package net.sf.openrocket.util;
4 import java.util.concurrent.atomic.AtomicInteger;
6 public class UniqueID {
8 private static AtomicInteger nextId = new AtomicInteger(1);
11 * Return a positive integer ID unique during this program execution.
12 * The values are taken as sequential numbers, and will re-occur in
13 * later executions of the program.
15 * This method is thread-safe and fast.
17 * @return a positive integer ID unique in this program execution.
19 public static int next() {
20 return nextId.getAndIncrement();
25 * Return a new universally unique ID string.
27 * @return a unique identifier string.
29 public static String uuid() {
30 return UUID.randomUUID().toString();