0

How to make unique RNG for alphabet and number?

i has to make a system to store 1000 data that unique..i have a logic but not have a sight about coding..

5th Feb 2017, 3:55 AM
Adly Alimin (mohd adly)
Adly Alimin (mohd adly) - avatar
1 Resposta
+ 1
You can use HashSet class for that. It has implemented the Set interface and it does not let you store same value more than once. https://docs.oracle.com/javase/7/docs/api/java/util/HashSet.html Note that, this HashSet does not maintain insertion order. That means if you insert 1 first there's no guarantee that the first index in the HashSet would contain 1. To maintain order you can use LinkedHashSet https://docs.oracle.com/javase/7/docs/api/java/util/LinkedHashSet.html
10th Feb 2017, 3:39 AM
Tahmid Choyon
Tahmid Choyon - avatar