Custom Set

in ita •  2 months ago

    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;
    
        }
    

      Authors get paid when people like you upvote their post.
      If you enjoyed what you read here, create your account today and start earning FREE VOILK!