Update README.md

This commit is contained in:
Fabio Lima 2021-11-27 02:45:30 -03:00 committed by GitHub
parent e23370f5fd
commit e03b50f303
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 17 deletions

View File

@ -199,6 +199,23 @@ byte[] random = ulid.getRandom(); // 10 bytes (80 bits)
byte[] random = Ulid.getRandom("0123456789ABCDEFGHJKMNPQRS"); // 10 bytes (80 bits) byte[] random = Ulid.getRandom("0123456789ABCDEFGHJKMNPQRS"); // 10 bytes (80 bits)
``` ```
Use a key generator that makes substitution easy if necessary:
```java
package com.example;
import com.github.f4b6a3.ulid.UlidCreator;
public class KeyGenerator {
public static String next() {
return UlidCreator.getUlid().toString();
}
}
```
```java
String key = KeyGenerator.next();
```
Use a `UlidFactory` with `java.util.Random`: Use a `UlidFactory` with `java.util.Random`:
```java ```java
@ -234,23 +251,6 @@ UlidFactory factory = UlidFactory.newInstance(() -> {
Ulid ulid = factory.create(); Ulid ulid = factory.create();
``` ```
Use a key generator that makes substitution easy if necessary:
```java
package com.example;
import com.github.f4b6a3.ulid.UlidCreator;
public class KeyGenerator {
public static String next() {
return UlidCreator.getUlid().toString();
}
}
```
```java
String key = KeyGenerator.next();
```
Benchmark Benchmark
------------------------------------------------------ ------------------------------------------------------