• Saves Valuable Time
  • Trusted Accuracy for 12 Years
  • 15-Day Money-Back Guarantee

VB Equivalent to Java Generics

Java generics and VB generics are implemented in totally different ways - Java generics uses the concept of 'type erasure' (compiling to Object and casts), while VB generics is a run-time feature, but you can usually achieve the same result by converting one to the other.

Defining a Generic Class

Java VB.NET
public class GenericClass<T> Public Class GenericClass(Of T)

Defining a Generic Class with a Constraint

Java VB.NET
public class GenericClass<T extends SomeBase> Public Class GenericClass(Of T As SomeBase)

Defining a Generic Method

Java VB.NET
public <T> void Method(T param) Public Sub Method(Of T)(ByVal param As T)

Defining a Generic Method with a Constraint

Java VB.NET
public <T extends SomeBase> void Method(T param) Public Sub Method(Of T As SomeBase)(ByVal param As T)


Use Java to VB Converter to convert from Java to VB.     

Additional resource: VB.NET and Java Equivalents


Copyright © 1997 – 2017 Tangible Software Solutions Inc.