/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.function.Function;
class A{
private final int x;
private A(int x) {
this.x=x;
}
public int getX() { return x; }
public static A build(Function<Builder, Builder> builderFiller) {
Builder builder = new Builder();
builder = builderFiller.apply(builder);
return builder.build();
}
public static class Builder{
private int x;
private Builder() {}
public Builder withX(int value){
this.x = value;
return this;
}
private A build(){
return new A(x);
}
}
}
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
A a = A.build(builder -> builder.withX(11));
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CmltcG9ydCBqYXZhLnV0aWwuZnVuY3Rpb24uRnVuY3Rpb247CgpjbGFzcyBBewogICAgcHJpdmF0ZSBmaW5hbCBpbnQgeDsKICAgIAogICAgcHJpdmF0ZSBBKGludCB4KSB7CiAgICAgICAgdGhpcy54PXg7CiAgICB9CgogICAgcHVibGljIGludCBnZXRYKCkgeyByZXR1cm4geDsgfQogICAgCiAgICBwdWJsaWMgc3RhdGljIEEgYnVpbGQoRnVuY3Rpb248QnVpbGRlciwgQnVpbGRlcj4gYnVpbGRlckZpbGxlcikgewogICAgICAgIEJ1aWxkZXIgYnVpbGRlciA9IG5ldyBCdWlsZGVyKCk7CiAgICAgICAgYnVpbGRlciA9IGJ1aWxkZXJGaWxsZXIuYXBwbHkoYnVpbGRlcik7CiAgICAgICAgcmV0dXJuIGJ1aWxkZXIuYnVpbGQoKTsKICAgIH0KCiAgICBwdWJsaWMgc3RhdGljIGNsYXNzIEJ1aWxkZXJ7CiAgICAgICAgcHJpdmF0ZSBpbnQgeDsKICAgICAgICAKICAgICAgICBwcml2YXRlIEJ1aWxkZXIoKSB7fQogICAgICAgIAogICAgICAgIHB1YmxpYyBCdWlsZGVyIHdpdGhYKGlud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