Advertisement
Guest User

Untitled

a guest
Nov 17th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.42 KB | None | 0 0
  1.    public void removeAllDuplicates()
  2.    {
  3.        String train = " ";
  4.        int i = 1;
  5.        train = train + words.get(0) + " ";
  6.        while(i<words.size()){
  7.            String test = " " + words.get(i) + " ";
  8.            if(train.contains(test)){
  9.                words.remove(i);
  10.            }
  11.            else
  12.            {
  13.                train = train + words.get(i) + " ";
  14.                i++;
  15.            }
  16.        }
  17.    }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement