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.119 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.118 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.117 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.116 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.115 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.114 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.113 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.111 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.110 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.109 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.108 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.107 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.106 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.105 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.104 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.103 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.102 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.101 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.100 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java
trackler-2.2.1.99 tracks/java/exercises/sum-of-multiples/.meta/src/reference/java/SumOfMultiples.java