■
例えば、(C++ で) 初期化リストの中や TMP では if 文なんて使えないので条件演算子を使わなければならない。
条件演算子・・・厨? - ぐるぐる~
匿名関数が定義できれば良いのにね。
public class test { private final int a; public test(int a) { this.a = a; } public test(final boolean b, final int x, final int y) { this(new java.util.concurrent.Callable<Integer>() { public Integer call() { if (b) return x; else return y; } }.call()); } }