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();
- boolean[] duplikate = new boolean[laenge];
- for (int i =0;i<laenge;i++){
- 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.contains(woerter.get(i))){
- dupes.add(woerter.get(i));
- }
- }
- return dupes;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement