Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public List<String> extrahiereDuplikate(List<String> woerter)
- {
- int laenge = woerter.size();
- List <String> referenz = new LinkedList();
- boolean[] duplikate = new boolean[laenge];
- for (int i =0;i<laenge;i++){
- String str3 = woerter.get(i);
- if (!referenz.contains(str3)){
- referenz.add(str3);
- }
- else {
- duplikate[i]=true;
- }
- // String str3 = woerter.get(i);
- // if(!referenz.contains(str3)){
- // referenz.add(str3);
- // }
- // else {
- // duplikate[i]=true;
- // }
- // for (int j=1+i;j<laenge;j++){
- // String str1 = woerter.get(i);
- // String str2 = woerter.get(j);
- // if(str1==str2){
- // duplikate[i]=true;
- // duplikate[j]=true;
- // }
- // }
- }
- List<String> dupes = new LinkedList();
- for (int i=0;i<laenge;i++){
- if (duplikate[i] ){
- dupes.add(woerter.get(i));
- }
- }
- return dupes;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement