All Downloads are FREE. Search and download functionalities are using the official Maven repository.

au.csiro.sparkle.spark.Long2LongAccumulableParam Maven / Gradle / Ivy

The newest version!
package au.csiro.sparkle.spark;

import it.unimi.dsi.fastutil.longs.Long2LongOpenHashMap;

import org.apache.spark.AccumulableParam;

import scala.Tuple2;

public class Long2LongAccumulableParam implements AccumulableParam> {


	private static final long serialVersionUID = 1L;

	@Override
	public Long2LongOpenHashMap addAccumulator(Long2LongOpenHashMap arg0,
			Tuple2 arg1) {
		arg0.addTo(arg1._1, arg1._2);
		return arg0;
	}

	@Override
	public Long2LongOpenHashMap addInPlace(final Long2LongOpenHashMap  arg0,
			Long2LongOpenHashMap arg1) {
		arg1.forEach((k,v) -> arg0.addTo(k, v));
		return arg0;
	}

	@Override
	public Long2LongOpenHashMap zero(Long2LongOpenHashMap arg0) {
		return new Long2LongOpenHashMap();
	}
	

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy