Custom Set

avatar

private final int a;

private final int b;

private final int c;

private PythagoreanTriplet() {

    this.a = 0;

    this.b = 0;

    this.c = 0;

}

public PythagoreanTriplet(int a, int b, int c) {

    this.a = a;

    this.b = b;

    this.c = c;

}

public static PythagoreanTripletListBuilder makeTripletsList() {

    return new PythagoreanTriplet().createBuilder();

}



  private PythagoreanTripletListBuilder createBuilder() {

    return new PythagoreanTripletListBuilder();

}

public class PythagoreanTripletListBuilder {

    private final List < PythagoreanTriplet > triplets = new ArrayList < > ();

    private int limit = 0;

    private int sum = 0;

    

    public PythagoreanTripletListBuilder withFactorsLessThanOrEqualTo(int limit) {

        this.limit = limit;

        return this;

    }



0
0
0.000
0 comments