Note that there are some explanatory texts on larger screens.

plurals
  1. POError while creating generic hash table
    text
    copied!<p>I am getting following error while trying to create generic HashTable.</p> <p><code>The method put(String, capture#2-of ?) in the type Hashtable&lt;String,capture#2-of ?&gt; is not applicable for the arguments (String, int)</code></p> <p>I need a HashTable, something like following: <code>HashTable&lt;String, HashTable&lt;String, AnyWrapperType&gt;&gt;</code></p> <p><code>by AnyWrapperType i mean it could be Integer or String or Character or Boolean</code></p> <p>I used <code>?</code> for <code>AnyWrapperType</code>, but i got an error.</p> <p>I also followed <a href="https://stackoverflow.com/questions/1921237/problem-using-generic-map-with-wildcard">link</a> from where i know what i was doing wrong but could find way out.</p> <pre><code> Hashtable&lt;String, Hashtable&lt;String, String&gt;&gt; paramTocol = new Hashtable&lt;&gt;(); if (standard != null &amp;&amp; (!standard.isEmpty())) { Hashtable&lt;String, String&gt; temp = new Hashtable&lt;&gt;(); temp.put(Appconstants.Col_studentinfo_S_Class, AvailableClass.getValueByName(standard)); paramTocol.put("standard", temp); } if (section != null &amp;&amp; (!section.isEmpty())) { Hashtable&lt;String, String&gt; temp = new Hashtable&lt;&gt;(); temp.put(Appconstants.Col_studentinfo_S_Section, section); paramTocol.put("section", temp); } </code></pre> <p>Here actual value of <code>standard is Integer</code> in database and value corresponding to <code>section is char</code>. I am given all these values as String and i need to store them in HashTable, So i want some raw hashtable that will hold all these values. None of the type is User-defined</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload