Java - Programing a string that doesn't repeat
up vote
-6
down vote
favorite
Im trying to creat a randomized string and put it into an ArrayList of strings in java. I dont want any duplicates in the arrayList . How can i make a program that satisfy that?
java
add a comment |
up vote
-6
down vote
favorite
Im trying to creat a randomized string and put it into an ArrayList of strings in java. I dont want any duplicates in the arrayList . How can i make a program that satisfy that?
java
3
Use aSet
to avoid the duplicates
– user7
Nov 22 at 15:31
1
In addition to user7's comment: If you want to keep the insert order, then use aLinkedHashSet
.
– Thomas
Nov 22 at 15:32
add a comment |
up vote
-6
down vote
favorite
up vote
-6
down vote
favorite
Im trying to creat a randomized string and put it into an ArrayList of strings in java. I dont want any duplicates in the arrayList . How can i make a program that satisfy that?
java
Im trying to creat a randomized string and put it into an ArrayList of strings in java. I dont want any duplicates in the arrayList . How can i make a program that satisfy that?
java
java
edited Nov 22 at 15:31
asked Nov 22 at 15:30
Xrayer
12
12
3
Use aSet
to avoid the duplicates
– user7
Nov 22 at 15:31
1
In addition to user7's comment: If you want to keep the insert order, then use aLinkedHashSet
.
– Thomas
Nov 22 at 15:32
add a comment |
3
Use aSet
to avoid the duplicates
– user7
Nov 22 at 15:31
1
In addition to user7's comment: If you want to keep the insert order, then use aLinkedHashSet
.
– Thomas
Nov 22 at 15:32
3
3
Use a
Set
to avoid the duplicates– user7
Nov 22 at 15:31
Use a
Set
to avoid the duplicates– user7
Nov 22 at 15:31
1
1
In addition to user7's comment: If you want to keep the insert order, then use a
LinkedHashSet
.– Thomas
Nov 22 at 15:32
In addition to user7's comment: If you want to keep the insert order, then use a
LinkedHashSet
.– Thomas
Nov 22 at 15:32
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53434159%2fjava-programing-a-string-that-doesnt-repeat%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
Use a
Set
to avoid the duplicates– user7
Nov 22 at 15:31
1
In addition to user7's comment: If you want to keep the insert order, then use a
LinkedHashSet
.– Thomas
Nov 22 at 15:32