![JAR search and dependency download from the Maven repository](/logo.png)
angry1980.audio.dao.TrackHashDAOInMemoryImpl Maven / Gradle / Ivy
package angry1980.audio.dao;
import angry1980.audio.model.TrackHash;
import java.util.*;
public class TrackHashDAOInMemoryImpl implements TrackHashDAO {
private Map> index;
public TrackHashDAOInMemoryImpl(){
this.index = new HashMap<>();
}
@Override
public Optional create(TrackHash hash) {
index.computeIfAbsent(hash.getHash(), l -> new ArrayList()).add(hash);
return Optional.of(hash);
}
@Override
public List findByHash(int hash) {
return index.getOrDefault(hash, Collections.emptyList());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy