@@ -0,0 +1,2657 @@
+package dev.codefoundry.lld;%0A%0Aimport java.util.function.Predicate;%0A%0Apublic class PasswordChecker %7B%0A    private List%3CPasswordSpec%3CString%3E%3E conditions;%0A%0A    public PasswordChecker(List%3CPasswordSpec%3CString%3E%3E conditions) %7B%0A        this.conditions = conditions;%0A    %7D%0A%0A    public int measureStrength(String password) %7B%0A        int strength = 0;%0A        for (PasswordSpec%3CString%3E condition : conditions) %7B%0A            if (condition.matches(password)) %7B%0A                strength++;%0A            %7D%0A        %7D%0A%0A        return strength;%0A    %7D%0A%0A    static interface Sizable %7B%0A        int length();%0A    %7D%0A%0A    interface PasswordSpec%3CT%3E %7B%0A        public boolean matches(T t);%0A    %7D%0A%0A    class NegatePasswordSpec implements PasswordSpec%3CT%3E %7B%0A        private final PasswordSpec%3CT%3E spec;%0A        public NegatePasswordSpec(PasswordSpec%3CT%3E spec) %7B%0A            this.spec = spec;%0A        %7D%0A%0A        public boolean matches(T t) %7B%0A            return !spec.matches(t);%0A        %7D%0A    %7D%0A%0A    class ContainsSpec implements PasswordSpec%3CT%3E %7B%0A        private final Set%3CT%3E values;%0A%0A        public ContainsSpec(Set%3CT%3E allowedValues) %7B%0A            this.values = values;%0A        %7D%0A%0A        public boolean matches(T t) %7B%0A            return this.values.contains(t);%0A        %7D%0A    %7D%0A%0A    class NotContainsSpec extends NegatePasswordSpec%3CT%3E %7B%0A        public NotContainsSpec(ContainsSpec%3CT%3E spec) %7B%0A            super(spec);%0A        %7D%0A    %7D%0A%0A    class AndSpec implements PasswordSpec%3CT%3E %7B%0A        private final PasswordSpec%3CT%3E left;%0A        private final PasswordSpec%3CT%3E right;%0A%0A        public AndSpec(PasswordSpec%3CT%3E left, PasswordSpec%3CT%3E right) %7B%0A            this.left = left;%0A            this.right = right;%0A        %7D%0A%0A        public boolean matches(T t) %7B%0A            return left.matches(t) && right.matches(t);%0A        %7D%0A    %7D%0A%0A    class MinLengthSpec%3CT extends Sizable%3E implements PasswordSpec%3CT%3E %7B%0A        private final int minLength;%0A        %0A        public MinLengthSpec(final int minLength) %7B%0A            this.minLength = minLength;%0A        %7D%0A%0A        @Override%0A        public boolean matches(T t) %7B%0A            return t.length() %3E= this.minLength;%0A        %7D%0A%0A    %7D%0A%0A    class MaxLengthSpec%3CT extends Sizable%3E implements PasswordSpec%3CT%3E %7B%0A        private final int maxLength;%0A%0A        public MaxLengthSpec(final int maxLength) %7B%0A            this.maxLength = maxLength;%0A        %7D%0A%0A        @Override%0A        public boolean matches(T t) %7B%0A            return t.length() %3C= this.maxLength;%0A        %7D%0A    %7D%0A%0A    class LengthSpec%3CT extends Sizable%3E extends AndSpec%3CT%3E %7B%0A        public LengthSpec(MinLengthSpec%3CT%3E left, MaxLengthSpec%3CT%3E right) %7B%0A            super(left, right);%0A        %7D%0A    %7D%0A%7D

Create PasswordChecker.java