• Saves Valuable Time
  • Trusted Accuracy for 12 Years
  • 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
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();

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

Copyright © 1997 – 2017 Tangible Software Solutions Inc.