Tangible Software Solutions

The Most Trusted Name in Source Code Conversion

  • Trusted for over 12 Years
  • Saves Valuable Time
  • Accurate and Reliable
  • Responsive Support

Java Equivalent to C++ std::unordered_map

The nearly exact C# equivalent to the C++ std::unordered_map collection is the Java HashMap collection.

Original C++:

#include <string>
#include <unordered_map>

virtual void UnorderedMap()
    std::unordered_map<std::wstring, int> myDictionary;
    std::wstring s = L"test";
    myDictionary[s] = 1;
    int i = myDictionary[s];
    i = myDictionary.size();
    bool b = myDictionary.empty();

Equivalent Java:

void UnorderedMap()
    java.util.HashMap<String, Integer> myDictionary = new java.util.HashMap<String, Integer>();
    String s = "test";
    myDictionary.put(s, 1);
    int i = myDictionary.get(s);
    i = myDictionary.size();
    boolean b = myDictionary.isEmpty();

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

Copyright © 1997 - 2017 Tangible Software Solutions Inc.