Sha256: b242b2a0a592356d696f3a54deb124f04c4b5cd8cd598dc286859a45298a73f0

Contents?: true

Size: 509 Bytes

Versions: 175

Compression:

Stored size: 509 Bytes

Contents

import java.util.Arrays;
import java.util.stream.IntStream;

public class SumOfMultiples {
    private final int sum;

    public SumOfMultiples(int number, int[] set) {
        sum = calculateSum(number, set);
    }

    public int getSum() {
        return sum;
    }

    private int calculateSum(int number, int[] set) {

        int sum = IntStream.range(1,number)
                .filter(i -> Arrays.stream(set).filter(j -> i % j == 0).count() > 0)
                .sum();

        return sum;
    }

}

Version data entries

175 entries across 175 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.179 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.178 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.177 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.176 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.175 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.174 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.173 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.172 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.171 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.170 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.169 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.167 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.166 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.165 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.164 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.163 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.162 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.161 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.160 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java