Is this jQuery like syntax valid in Java? -


in c++, chain-able syntax invalid.

        builder.setmessage("are sure want exit?")            .setcancelable(false)            .setpositivebutton("yes", new dialoginterface.onclicklistener() {                public void onclick(dialoginterface dialog, int id) {                     act.finish();                }            })            .setnegativebutton("no", new dialoginterface.onclicklistener() {                public void onclick(dialoginterface dialog, int id) {                     dialog.cancel();                }            }); 

as long methods return same object, work fine.

it work in c++ too, except anonymous inner classes. (which c++ doesn't support until c++0x)
however, in c++, more performant return pointers , use -> operator.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -