Konstruktorüberladungsmehrdeutigkeit aufgelöst

public class Player
{
    private final String name;
    private final int nationalRank;
    private final int internationalRank;

    // Constructor becomes private
    private Player(final Builder builder)
    {
        name = builder.name;
        nationalRank = builder.nationalRank;
        internationalRank = builder.internationalRank;
    }

    public static Builder withName(final String name)
    {
        return new Builder(name);
    }

    // Inner builder class
    public static class Builder
    {
        private final String name;
        private int nationalRank;
        private int internationalRank;

        private Builder(final String name)
        {
            this.name = name;
        }

        public Builder withNationalRank(int rank)
        {
            nationalRank = rank;
            return this;
        }

        public Builder withInternationalRank(int rank)
        {
            internationationalRank = rank;
            return this;
        }

        public Player build()
        {
            return new Player(this);
        }
    }
}
Karthik .b