Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
mikima
mikima's Profile
1
Posts
1
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
how to remove duplicates from ArrayList
[3 Replies]
27-Jul-2010 05:09 AM
Forum:
Programming Questions
hi to all,
i'm new with processing, and i have a proble. i have an arraylist of strings, and i must remove duplicates values
In short, if i have
[1,2,1,1,2,4,2]
i want
[1,2,4].
I've tried this:
for(int i=0; i<allNames.size(); i++) {
for(int j=i+1; j<allNames.size(); j++) {
if(allNames.get(i)==allNames.get(j)) {
allNames.remove(j);
j--;
}
}
}
but it doesn't work.
i really don't understand where is my mistake.
I also checked here (
http://download.oracle.com/docs/cd/E17476_01/javase/1.4.2/docs/api/java/util/List.html
) but i don't find a solution.
«Prev
Next »
Moderate user : mikima
Forum