Friday, April 22, 2016

Create a GUID in Java

Some software development tasks need a way to generate unique identifiers. I saw several homegrown solutions, but Java 5 makes the process a breeze. It contains class UUID which can generate type 4 (pseudo randomly generated) unique identifiers. Here is a simple example:
package net.softwaregeek;

import java.util.UUID;

public class UUIDMain {
    public static void main(final String[] args) {
        System.out.println(UUID.randomUUID());
    }
}
The code is self-explanatory. It generates a unique identifier and prints it to console. Class UUID contains several other useful methods which I encourage you to explore on your own.

26 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Really awesome blog. Your blog is really useful for me. Thanks for sharing this informative blog. Keep update your blog...Java Training in Chennai
    Java Training Institute in Chennai

    ReplyDelete
  3. It's interesting that many of the bloggers to helped clarify a few things for me as well as giving. Most of ideas can be nice content. The people to give them a good shake to get your point and across the command.
    oracle training in chennai|| hadoop training in chennai

    ReplyDelete
  4. Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updating.
    oracle training in chennai|| hadoop training in chennai

    ReplyDelete
  5. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging…
    Regards,
    hadoop training in chennai || selenium training in chennai




    ReplyDelete
  6. I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.
    big-data-hadoop-training-institute-in-bangalore

    ReplyDelete
  7. Very good informative article. Thanks for sharing such nice article, keep on up dating such good articles.

    Internet Of Things Services | Austere Technologies

    ReplyDelete
  8. wow...nice blog, very helpful information. Thanks for sharing.

    Mobilty Services | Austere Technologies

    ReplyDelete
  9. Great article, really very helpful content you made. Thank you, keep sharing.

    Digital Transformation Services | Austere Technologies

    ReplyDelete
  10. Nice blog with excellent information. Thank you, keep sharing.

    Cloud Services | Austere Technologies

    ReplyDelete
  11. VERY INFORMATIVE BLOG. KEEP SHARING SUCH A GOOD ARTICLES.

    Best Software Company | Austere Technologies

    ReplyDelete
  12. Really great blog, it's very helpful and has great knowledgeable information. Thanks for sharing.

    Best Quality Managment Services | Austere Technologies

    ReplyDelete
  13. your tutorials are very nice explanation and also visit for a real time training for Java Training in Chennai | Best Java Training Institute in Chennai | Java Master Program Training in Chennai

    ReplyDelete
  14. This is the best place where we can get good collection of information with an excellent explanation, thanks much for sharing the useful info do keep on sharing...
    Best Online Software Training Institute | Advanceed Java Training

    ReplyDelete
  15. Great article, really very helpful content you made. Thank you, keep sharing.
    Summer Course Training in Chennai | Summer Course Training in Madipakkam

    ReplyDelete
  16. Really great blog, it's very helpful and has great knowledgeable information. Thanks for sharing.
    Summer Course Training in Chennai | Summer Course Training in Velachery

    ReplyDelete
  17. Another interesting article.I am amazed.Thanks, I really appreciate the kind words.
    OCJP Exam Center in Chennai | OCJP Exam Center in Velachery

    ReplyDelete
  18. VERY INFORMATIVE BLOG. KEEP SHARING SUCH A GOOD ARTICLES.

    Best Cloud Solutions | Austere Technologies

    ReplyDelete
  19. Awesome post. Really you are shared very informative concept... Thank you for sharing. Keep on updating...
    Python Courses Certifications Training in Chennai | Excellent Python Classes in Saidapet

    ReplyDelete
  20. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging…
    Cisco Certifications Coaching Center in Chennai | Best Cisco Courses in Chromepet

    ReplyDelete
  21. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
    ISTQB Certifications Course in Chennai | QA Testing in Medavakkam

    ReplyDelete