Tangible Software Solutions

The Most Trusted Name in Source Code Conversion

VB Equivalent to Java Functional Interfaces

The closest VB equivalent to Java's functional interfaces are VB delegates.

Original Java:

@FunctionalInterface
public interface FooFunctional
{
   void invoke();
}

public class UseFunctionalInterface
{
   void method()
   {
      FooFunctional funcVar = () -> voidMethod();
      funcVar.invoke();
   }
   void voidMethod()
   {
   }
}

Equivalent VB:

Public Delegate Sub FooFunctional()

Public Class UseFunctionalInterface
   Friend Overridable Sub method()
      Dim funcVar As FooFunctional = Sub() voidMethod()
      funcVar()
   End Sub
   Friend Overridable Sub voidMethod()
   End Sub
End Class

If you need to convert from Java to VB and you are depending on the results being reliable and accurate, then you will want to have Java to VB Converter, the best Java to VB converter, at your fingertips.

Copyright © 1997 - 2017 Tangible Software Solutions Inc.