Is there a javascript bind like function in java -


I am new to Java and I want to know that Java has some similar functionality like Javascript Tie.

ex:

  function x (shared ARG, AG1, AGR2) {} X. Bind (this, 'bounded erg'); X ('arg1', 'arg2');  

Update:

A good example would be in the callback function of the event.

What if I have an object / argument available in the actual event, the callback context, which was previously available at the time of setting up callback in an event.

In Java, you do not have to pass around "callback".

You pass some object examples that implement some callback interface.

For example,

  interface clickth handler {void handleClick (event)  

Event); } // and then the last string someStateIHave = "Hello"; MyButton.setClickHandler {void handleClick} {System.out.println (someStateIHave);}}

As you can see, there is an object instance of ClickHandler (In this case unknown intrinsic class, but it is not necessary). UI Framework can then call the handleClick method on this object. P>

This pattern (anonymous implementation of the Single Mode Interface) is so frequent that Java 8 has a special, concise syntax for it.


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -