You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 734 B

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
12345678910111213141516171819202122232425262728293031323334
  1. ## л
  2. JDK 1.8+
  3. ## maven
  4. ```
  5. <dependency>
  6. <groupId>com.github.yitter</groupId>
  7. <artifactId>yitter-idgenerator</artifactId>
  8. <version>1.0.3</version>
  9. </dependency>
  10. ```
  11. ## ʾ
  12. ```
  13. // ȫֳʼWorkerIdĬ2^16-1ͨ WorkerIdBitLength ֵ
  14. IdGeneratorOptions options = new IdGeneratorOptions();
  15. options.WorkerId = 1;
  16. YitIdHelper.setIdGenerator(options);
  17. // ϳʼȫֻһΣұ
  18. // ʼԺ󣬼ҪIDĵط·
  19. long newId = YitIdHelper.nextId();
  20. ```
  21. DIܼɣԲο YitIdHelper ȥ IdGenerator ʹ****ģʽ
  22. ## options Ĭֵ˵
  23. οԴ룺/contract/IdGeneratorOptions.java

雪花算法中非常好用的数字ID生成器