title: Saving the Tokens into ArraysList and compare each in Java
body: <p>i am working on plagiarism detection system for that i need to compare two strings and show the similarity result.</p>
  
  <p>I have two strings i have converted them into tokens separated with the spaces, now i want to save them in ArrayList, so that i can compare them and show the the result of same index in sequence.</p>
  
  <p>My Source code is</p>
  
  <pre><code>public static void main(String[] args) {
      // TODO code application logic here
  
      String str1 = "This is String number one";
      String str2 = "This is String number two";
  
      StringTokenizer st1 = new StringTokenizer(str1);
      StringTokenizer st2 = new StringTokenizer(str2);
  
      System.out.println("---Split by space---");
      ArrayList&lt;String&gt; list1 = new ArrayList&lt;String&gt;();
  
      list1.add(str1);
  
  // was trying to save the tokens in arraylist...
  
      ArrayList&lt;String&gt; list2 = new ArrayList&lt;String&gt;();
      list2.add(str2);
  
      for (String number : list1) {
  System.out.println("String 1 = " + number);
  }
      for (String number : list2) {
  System.out.println("String 2 = " + number);
  }
  
  }
  }
  </code></pre>
  
  <p>Any Suggestions/Examples would be helpful. </p>