PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, September 20, 2022

[FIXED] How to write an Action function with two parameter in java

 September 20, 2022     action, consumer, java, java-8, vb.net     No comments   

Issue

I have below function written in VB.Net, Is there a way to convert this to Java. I tried Consumer() but it only accepts one parameter.

Dim setFunc 
As Action(Of String, Object) = Sub(name, val) 
                               Console.WriteLine
                               ("Test Function. Name: {0}, Value: {1}", name, val)

Solution

Have you tried this

BiConsumer<String, Object> setFunc = 
      (x, y) -> System.out.println("Test Function. Name : " + x + ", Value " + y);


Answered By - Yassin Hajaj
Answer Checked By - Robin (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing