class WeightedInput implements Comparable<WeightedInput>, SimilarityInput {

    static  WeightedInput[] prepareDenseWeights(List<Map<String, Object>> data, long degreeCutoff, Double skipValue) {
        WeightedInput[] inputs = new WeightedInput[data.size()];
        int idx = 0;

        boolean skipAnything = skipValue != null;
        boolean skipNan = skipAnything && Double.isNaN(skipValue);

        for (Map<String, Object> row : data) {
            List<Number> weightList = SimilarityInput.extractValues(row.get("weights"));

            long weightsSize = skipAnything ? skipSize(skipValue, skipNan, weightList) : weightList.size();

            if (weightsSize > degreeCutoff) {
                double[] weights = Weights.buildWeights(weightList);
                inputs[idx++] = skipValue == null ? dense((Long) row.get("item"), weights) : dense((Long) row.get("item"), weights, skipValue);
            }
        }
        if (idx != inputs.length) inputs = Arrays.copyOf(inputs, idx);
        Arrays.sort(inputs);
        return inputs;
    }

    public  WeightedInput(long id, double[] weights, int fullSize, int itemCount);
    public  WeightedInput(long id, double[] weights, double skipValue);
    public  WeightedInput(long id, double[] weights);

}