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

angry1980.audio.similarity.TrackSimilarities Maven / Gradle / Ivy

There is a newer version: 0.0.10
Show newest version
package angry1980.audio.similarity;

import angry1980.audio.model.Track;
import angry1980.audio.model.TrackSimilarity;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableSet;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class TrackSimilarities {

    private final Track track;
    private final ImmutableCollection similarities;

    public TrackSimilarities(Track track, Collection similarities) {
        this.track = track;
        this.similarities = ImmutableSet.copyOf(similarities);
    }

    public Track getTrack() {
        return track;
    }

    public Collection getSimilarities() {
        return similarities;
    }

    public Map> groupByTrack(){
        return similarities.stream()
                .collect(Collectors.groupingBy(ts -> ts.getTrack2()));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy