title: How to separate an array list into individual letters in Java
body: <p>I am working on an assignment that wants me to create a program that accepts a text file with words in it, goes through every word, and then outputs the word with the most amount of double letters. So if a text file had 2 words, (past and progressive for example), it would output progressive. My problem is getting the program to compare each letter in a word. Specifically I cant seem to figure out how to split each word into its letters. Here is what I have so far. </p>
  
  <pre><code>import java.io.File;
  import java.io.FileNotFoundException;
  import java.util.ArrayList;
  import java.util.List;
  import java.util.Scanner;
  
  public class Doubles {
  
  public static void main(String[] args) {
      Scanner keyboard = new Scanner(System.in);
      ///Prompts the user to give a file.
      System.out.println("Enter the location of your file...");
      String location = keyboard.next();
      Scanner file = null;
      List&lt;String&gt; list = new ArrayList&lt;String&gt;();
      ///If the the file location is wrong, give an error. 
      try {
          file = new Scanner(new File(location));
      } catch (FileNotFoundException e) {
          System.out.println("Error: File not found");
          System.exit(1);
      }
  
  
      while(file.hasNext()){
          String word = file.nextLine();
          list.add(word);
      }
      ///System.out.println(list);
      keyboard.close();
  
      doublefinder(list);
  
  }
  
  private static void doublefinder(List&lt;String&gt; list) {
          ///Code to separate and compare letters.
      }
  
  }
  </code></pre>
  
  <p>I have tried many different approaches but I can't seem to find a solution. Any help would be much appreciated. </p>