Suids are distributed, Scoped, Unique IDs that are short and sweet.
See the main project for details.
- suid-java-0.12.0.jar (signature)
- suid-java-0.12.0-sources.jar (signature)
- suid-java-0.12.0-javadoc.jar (signature)
<dependency>
<groupId>ws.suid</groupId>
<artifactId>suid-java</artifactId>
<version>0.12.0</version>
</dependency>
import ws.suid.Suid;
- Create a Suid from a long
- Create a Suid from a string
- Get a Suid's underlying value
- Convert a Suid to a Long
- Convert a Suid to a String
- Convert a Suid list to a Long list
- Convert a Suid list to a String List
- Convert a Long list to a Suid list
- Convert a String list to a Suid list
Suid id = new Suid(1903154L);
System.out.println(id); // 14she
Suid id = new Suid("14she");
System.out.println(id); // 14she
Suid id = new Suid("14she");
System.out.println(id.longValue()); // 1903154
Suid id = new Suid("14she");
Long val = id.toLong();
System.out.println(val); // 1903154
Suid id = new Suid("14she");
String val = id.toString();
System.out.println(val); // 14she
List<Suid> ids = Arrays.asList(new Suid[]{new Suid(1903154), new Suid(1903155), new Suid(1903156)});
System.out.println(ids); // [14she, 14shf, 14shg]
List<Long> vals = Suid.toLong(ids);
System.out.println(vals); // [1903154, 1903155, 1903156]
List<Suid> ids = Arrays.asList(new Suid[]{new Suid(1903154), new Suid(1903155), new Suid(1903156)});
System.out.println(ids); // [14she, 14shf, 14shg]
List<String> vals = Suid.toString(ids);
System.out.println(vals); // [14she, 14shf, 14shg]
List<Long> vals = Arrays.asList(new Long[]{Long.valueOf(1903154), Long.valueOf(1903155), Long.valueOf(1903156)});
System.out.println(vals); // [1903154, 1903155, 1903156]
List<Suid> ids = Suid.fromLong(vals);
System.out.println(ids); // [14she, 14shf, 14shg]
List<String> vals = Arrays.asList(new String[]{"14she", "14shf", "14shg"});
System.out.println(vals); // [14she, 14shf, 14shg]
List<Suid> ids = Suid.fromString(vals);
System.out.println(ids); // [14she, 14shf, 14shg]
Copyright (c) 2017 by Stijn de Witt. Some rights reserved.
Creative Commons Attribution 4.0 International (CC BY 4.0) https://creativecommons.org/licenses/by/4.0/