daily pastebin goal
53%
SHARE
TWEET

java callback closure with argument

Nashev Jun 19th, 2017 (edited) 127 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public interface nodeProcessCallback {void run(Element item);}
  2.  
  3.     protected void processNodes(String tagName, nodeProcessCallback callback) {
  4.         ....
  5.         callback.run(item);
  6.         ....
  7.     }
  8.    
  9.     private void processTable(Element item){
  10.         ....
  11.     }
  12.  
  13.     public void execute() throws Exception {
  14.         ....
  15.         // send processTable as callback:
  16.         processNodes("TABLE", (item) -> processTable(item));
  17.         ....
  18.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top