MahoutEvaluator { static void storePopulation(FileSystem fs, Path f, Iterable<?> population) throws IOException { FSDataOutputStream out = fs.create(f); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out)); try { for (Object candidate : population) { writer.write(StringUtils.toString(candidate)); writer.newLine(); } } finally { Closeables.closeQuietly(writer); } } private  MahoutEvaluator(); static void evaluate(FitnessEvaluator<?> evaluator,
                              Iterable<?> population,
                              Collection<Double> evaluations,
                              Path input,
                              Path output);  }
@Test public void testStoreLoadPopulation() throws Exception { List<DummyCandidate> population = DummyCandidate.generatePopulation(POPULATION_SIZE); Path tempPath = getTestTempFilePath("test.txt"); FileSystem fs = tempPath.getFileSystem(new Configuration()); MahoutEvaluator.storePopulation(fs, tempPath, population); List<DummyCandidate> inpop = loadPopulation(fs, tempPath); assertEquals("Population size", population.size(), inpop.size()); for (int index = 0; index < population.size(); index++) { assertEquals("Bad candidate " + index, population.get(index), inpop.get(index)); } }