code: public static <T> void loadCollection(File file, Class<T> itemClass, Collection<T> collection) throws NoSuchMethodException, InstantiationException, IllegalAccessException,
        InvocationTargetException, IOException {
      Constructor<T> itemConstructor = itemClass.getConstructor(String.class);
      BufferedReader in = new BufferedReader(new FileReader(file));
      String line = in.readLine();
      while (line != null && line.length() > 0) {
        T t = itemConstructor.newInstance(line);
        collection.add(t);
        line = in.readLine();
      }
      in.close();
    }
docs: Adds the items from the file to the collection.
  
  @param <T>
  The type of the items.
  @param file
  The file from which items should be loaded.
  @param itemClass
  The class of the items (must have a constructor that accepts a
  String).
  @param collection
  The collection to which items should be added.