@Test
  public void optimizeRand() throws IOException {
    Optimizer optimizer = new Optimizer();
    long start;
    List<Vol> optimize;

    for (int i = 0; i < 1; i++) {
      List<Vol> list = randList(100000);

      start = System.currentTimeMillis();
      //            optimize = optimizer.optimize3(null, list);
      //            System.out.println(optimizer.formatString(optimize));
      //            System.out.println(System.currentTimeMillis() - start);
      //            System.out.println(Vol.toString(optimize));

      start = System.currentTimeMillis();
      List<Vol> optimize2 = optimizer.optimize4(list);
      long duration = System.currentTimeMillis() - start;
      System.out.println(optimizer.formatString(optimize2));
      System.out.println(duration);
      //            System.out.println(Vol.toString(optimize2));

      //
      // assertThat(Optimizer.price(optimize)).isLessThanOrEqualTo(Optimizer.price(optimize2));
      Iterator<Vol> iterator = optimize2.iterator();

      Vol vol = iterator.next();
      while (iterator.hasNext()) {
        Vol next = iterator.next();
        assertThat(vol.isNext(next)).isTrue();
        vol = next;
      }
    }
  }
  private List<Vol> randList(int size) {
    List<Vol> vols = new LinkedList<Vol>();
    for (int i = 0; i < size; i++) {
      Vol vol = new Vol();
      vol.setDepart(rand.nextInt(50000));
      vol.setDuree(rand.nextInt(100) + 1);
      vol.setPrix(rand.nextInt(15000));
      vol.setVol(UUID.randomUUID().toString());
      vols.add(vol);
    }

    return vols;
  }
 @Test
 public void optimizeTest() throws IOException {
   List<Map> maps = mapper.readValue(json, new TypeReference<List<Map>>() {});
   Optimizer optimizer = new Optimizer();
   List<Vol> optimize = optimizer.optimize4(Vol.fromMaps(maps));
   System.out.println(optimizer.formatString(optimize));
 }