• Saves Valuable Time
  • Trusted Accuracy since 2004
  • 15-Day Money-Back Guarantee

Java Equivalent to VB Dictionary

The nearly exact Java equivalent to the .NET Dictionary collection is the HashMap collection.

VB Java
Imports System.Collections.Generic

Sub Dictionaries()
    Dim map As New Dictionary(Of String, Integer)()
    Dim s As String = "test"
    map.Add(s, 1)
    Dim i As Integer = map(s)
    i = map.Count
    Dim b As Boolean = map.Count = 0
    map.Remove(s)
End Sub
void Dictionaries()
{
    java.util.HashMap<String, Integer> map = new java.util.HashMap<String, Integer>();
    String s = "test";
    map.put(s, 1);
    int i = map.get(s);
    i = map.size();
    boolean b = map.isEmpty();
    map.remove(s);
}


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

Additional resource: VB.NET and Java Equivalents


Copyright © 2004 – 2019 Tangible Software Solutions, Inc.