code: public static void saveMapFileSequences(String path, JavaRDD<List<List<Writable>>> rdd, Configuration c,
                       Integer maxOutputFiles) {
          path = FilenameUtils.normalize(path, true);
          if (maxOutputFiles != null) {
              rdd = rdd.coalesce(maxOutputFiles);
          }
          JavaPairRDD<List<List<Writable>>, Long> dataIndexPairs = rdd.zipWithIndex();
          JavaPairRDD<LongWritable, SequenceRecordWritable> keyedByIndex =
                          dataIndexPairs.mapToPair(new SequenceRecordSavePrepPairFunction());
  
          keyedByIndex.saveAsNewAPIHadoopFile(path, LongWritable.class, SequenceRecordWritable.class,
                          MapFileOutputFormat.class, c);
      }
docs: Save a {@code JavaRDD<List<List<Writable>>>} to a Hadoop {@link org.apache.hadoop.io.MapFile}. Each record is
  given a <i>unique and contiguous</i> {@link LongWritable} key, and values are stored as
  {@link SequenceRecordWritable} instances.<br>
  <b>Note</b>: If contiguous keys are not required, using a sequence file instead is preferable from a performance
  point of view. Contiguous keys are often only required for non-Spark use cases, such as with
  {@link org.datavec.hadoop.records.reader.mapfile.MapFileSequenceRecordReader}<br>
  <p>
  Use {@link #restoreMapFileSequences(String, JavaSparkContext)} to restore values saved with this method.
  
  @param path Path to save the MapFile
  @param rdd  RDD to save
  @param c    Configuration object, used to customise options for the map file
  @see #saveMapFileSequences(String, JavaRDD)
  @see #saveSequenceFile(String, JavaRDD)