package com.ved.musicmapapp.utils;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.Executor;
public class SerialExecutor {
private Executor mExecutor;
private Map<String, Runnable> mRunables;
public SerialExecutor(Executor executor) {
mExecutor = executor;
mRunables = new LinkedHashMap<String, Runnable>();
}
public void execute(String key, Runnable runable){
if(!mRunables.containsKey(key)){
mRunables.put(key, runable);
mExecutor.execute(runable);
}
}
}