Hello,
I am working with Taverna to build a workflow. Taverna has a beanshell where I can program in java. I am having some problems in writing a script, where I want to eliminate the duplicates in an array (String).
for (int k=0; k<myLength; k++){
boolean isthere=false;
for (int l=0; l<sizeres; l++){
if (res[l].equals(my[k])){
isthere=true;
break;
}
}
if (isthere == false){
res[free]= my[k];
temp.append(res[free] + "\n");
free++;
}
}
The beanshell gives me an error in the method .equals(my[k]).
Has anyone work with beanshell already?
Does anyone has an idea how to delete duplicates from an array of String in a easier way?
I also thought about java.util.Set, but it not working too.
Thank you in advance,
Mokita
I am working with Taverna to build a workflow. Taverna has a beanshell where I can program in java. I am having some problems in writing a script, where I want to eliminate the duplicates in an array (String).
for (int k=0; k<myLength; k++){
boolean isthere=false;
for (int l=0; l<sizeres; l++){
if (res[l].equals(my[k])){
isthere=true;
break;
}
}
if (isthere == false){
res[free]= my[k];
temp.append(res[free] + "\n");
free++;
}
}
The beanshell gives me an error in the method .equals(my[k]).
Has anyone work with beanshell already?
Does anyone has an idea how to delete duplicates from an array of String in a easier way?
I also thought about java.util.Set, but it not working too.
Thank you in advance,
Mokita
Comment