Skip to content

Commit 2a4d72f

Browse files
committed
Add usage information
1 parent 771cdb7 commit 2a4d72f

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,21 @@ Often, one needs to use non-sequential IDs in places where users will see them,
99

1010
## Usage
1111

12+
```
13+
public String shortUuid() {
14+
ShortUuid.Builder builder = new ShortUuid.Builder();
15+
ShortUuid shortUuid = builder.build(UUID.randomUUID());
16+
17+
return shortUuid.toString();
18+
}
19+
20+
public UUID getUuid(String shortUuid) {
21+
ShortUuid.Builder builder = new ShortUuid.Builder();
22+
23+
return UUID.fromString(builder.decode(shortUuid));
24+
}
25+
```
26+
1227
## License
1328

1429
MIT

0 commit comments

Comments
 (0)