Java HashMap

Hello
Can I create a HashMap in Java to store int,int pair ?
HashMap map = new HashMap();
map.put(int id,int val);
It seems that it only accepts Object types as arguments. Can anyone suggest any other data structure to store key-value pair both of type Int ?
thanks
Askar

I wonder why it didn't work earlier, it was only accepting Object types and not primitives.
Oh, I did change to Java 5.Earlier, you were using some pre-version 5 compiler, so you would have had to write:
tagMap.put(new Integer(itemID), new Integer(count_tags));Which is not that bad -- lots of Java developers lived with it pre-version 5.
But now that you've updated the compiler, I don't know why generics aren't accepted. Maybe it's an Eclipse thing:
Map < Integer, Integer > tagMap = new HashMap < Integer, Integer > ();

Similar Messages

  • Pass java HASHMAP to oralce procedure

    Hi,
    I have Java HashMap(<key, value). Can i pass it to oracle procedure?
    I am using java 1.4 and oracle 10g.
    any help

    Hi,
    Some information, From the point of the view that the need is to pass an object from java to PLSQL or vice versa (Not HashMap, but data which can be manipulated in PLSQL)
    What you need to do/investigate is ..
    1. Load your java files to database (using loadjava integrated in JDev better, else seperately)
    2. Create PLSQL procedure for the java method using JDev)
    3. Define PLSQL object which you want to use as counter part of the java object. (Its reverse, first create plsql object)
    4. In jdeveloper connection navigator,use generte java to generate corresponding java object class.
    The above information is to fascilitate information exchange between java and PLSQL in terms of Objects. Based on one of projects I had done.
    If abouvGive a little try and probably you may be able to do reverse (first define Java OBject (you have HashMap here) and then the PLSQL Object.)
    Most of the things are automated in JDeveloper. Just explore it.
    Abdul Wahid

  • Storing a Java HashMap in a Table

    Hi! I would like to know how to store a HashMap in an Oracle table and if so how should I create the Table with suitable column type.Thanks

    Each entry in your HashMap is a Map.Entry with one Java Object representing its Key and another representing its Value. You need a table with at least two columns to store this information, one for the Key and one for the Value.
    The data types you need in this table will be determined by the data types you are using for these two objects in your HashMap. For example, if I use a character Key of no more than 40 characters but of variable length I would create a column of datatype VARCHAR(40) NOT NULL to hold these values and if my Value objects were really floating point numbers I would use a DOUBLE and so on.
    If you have a mixture of Object types for the Key or the Value you are going to have to store a generalized representation of the object types; see topics discussing storage of serialized or XML object representations in a relational database.

  • Collision in Java HashMap

    I am under the expression that if two key-value pairs hash to the same position, both values will be stored at the same hashcode position and no value will be overwritten. However, why is the following code giving me different result? Can anyone explain please
    Thank you
    Xin
    import java.util.HashMap;
    import java.util.Hashtable;
    * @author xint
    public class Main {
    * @param args the command line arguments
    public static void main(String[] args) {
    // Test collision in HashMap
    HashMap<String, String> hm = new HashMap<String,String>();
    hm.put("xint", "University of Toronto");
    hm.put("xint", "University of California");
    System.out.println(hm.containsValue("University of Toronto"));
    }

    xerox.time wrote:
    I am under the expression that if two key-value pairs hash to the same position, both values will be stored at the same hashcode position and no value will be overwritten. However, why is the following code giving me different result? Can anyone explain please Nothing will be overwritten if the keys are not equal.
    Here you have two keys that not only have the same hashCode, but also are equal(). If you had two keys that had the same hashCode but were not equal, then they would hash to the same bucket, but both would be present in the map--neither would overwrite the other.
    In the future, when posting code, use code tags so it will be readable. Copy/paste from your original source in your editor, highlight the code, and click the CODE button.

  • Weblogic 10.3 error apache ListOrderedMap cannot be cast to java HashMap.

    Hi All,
    I'm having following code which is using spring(version: 2.0) dao
    public Map<String, String> getEmplyeeMap() throws Exception {     
              StringBuffer query = new StringBuffer("");
              query.append("select emp_name,dept_name from EMPLOYEE order by emp_no");
              logger.info("Inside getEmplyeeMap...Query to be executed :"+query.toString());     
              Map<String, String> EmpMap = new LinkedHashMap<String, String>();
              List<Map<String,String>> l_lstQueryRes = (ArrayList<Map<String,String>>)getJdbcTemplate().queryForList(query.toString());
              logger.info("l_lstQueryRes:"+l_lstQueryRes);
              if (l_lstQueryRes != null)
                   for (int l_iLoop = 0; l_iLoop < l_lstQueryRes.size(); l_iLoop++)
                        Map<String,String> l_mapRowData = new HashMap<String,String>();
                        l_mapRowData = (HashMap<String,String>)l_lstQueryRes.get(l_iLoop);                    
                        EmpMap.put(l_mapRowData.get("emp_name"), l_mapRowData.get("dept_name"));
                   }//End of for loop
              }//End of if loop          
              logger.info("EmpMap list size is.." + EmpMap.size());
              return EmpMap;
         } //End of getEmplyeeMap
    getting below error
    org.apache.commons.collections.map.ListOrderedMap cannot be cast to java.util.HashMap
    I'm thinking this problem is occurring because of jdk1.6 version, is anyone come across this problem?? This same working good in weblogic9.2 version.
    Thanks advance.
    Regards,
    Sharath.

    user9222505 wrote:
    Ok, thanks. So how do i determine where we are at since I have this "465"? How does that relate to a particular patch?
    Logger@9214443 3.5.3/465I believe, you are on 3.5.3 unpatched, and if I correctly remember, after applying the 3.5.3 patch 4 it should like like 3.5.3p4/... or 3.5.3.4/... (don't remember which one)... You would have to download that patch from your Oracle Support website (whichever you use), and apply the patch to a pristine extracted directory of 3.5.3 according to instructions in the patch zip.
    Starting with a recent version no more manual patching is necessary and you can download full distributions of patched versions from Oracle Support, but I don't think that applies to 3.5.3, yet (although it is possible that they recreated patch artifacts like that for earlir versions).
    If you do not have a support contract then you cannot download a patch or patched versions. You can only download a new full release which always has any previously released patches incorporated, though 3.5.3 is the last 3.5 full release if I correctly remember... and 3.6 comes with code incompatibilities at a few places so it is not a drop-in replacement...
    Best regards,
    Robert

  • Java Hashmaps in jdk 1.4

    Hi All,
    I am trying to work out on a previous jdk 1.5 code for hashmap to be converted to jdk 1.4,
    public HashMap<String, String> getDispalyLinkUrls() throws SQLException {
         HashMap<String, String> hashMapValues = new HashMap<String, String>();
    My code looks like above...
    I am getting an error, stating that invalide method declaration and return type required.. Please suggest me, in conversion of my code to jdk 1.4
    Many Thanks!!

    Hi All,
    I am somehow still facin trouble with array list, as it is retrieving only one value or not the appropriate values from the database. Please correct my Hashmap code, wherein I have an object on a jsp, upon which I place the mouse, I should get an object drop down from the database. My JSP code looks like this:
    <div id=Menu0 style="position: absolute; border: 1px solid #000000; visibility:hidden; z-ndex: 1">
    <table bgcolor=white cellspacing=0 cellpadding=0 style="border-collapse: collapse;">
    <%
    DisplayLinkUrls displayLinkUrl = new DisplayLinkUrls();
    HashMap<String, String> hmValues = displayLinkUrl.getDispalyLinkUrls();
    for(String strKey :hmValues.keySet()) {
         %>
    <tr height=25 onmouseout=menuOut(this,'#ffeecc') onmouseover=menuOver(this,'#FFFFFF')>
    <td bgcolor=white>   </td><td align=right>
    <a class=asd href="<%=hmValues.get(strKey)%>">  <%=strKey%>  </a>    </td></tr>
    <%
    %>
    </table>
    </div>
    My Servlet to which it calls when connecting DB looks like this:
         public HashMap<String, String> getDispalyLinkUrls() throws SQLException {
         HashMap<String, String> hashMapValues = new HashMap<String, String>();
         //Set set = hashMapValues.entrySet();
    //Iterator i=set.iterator();
              DisplayLinkUrls displayLinkUrl = new DisplayLinkUrls();     
              Statement stmt = displayLinkUrl.getDBConnection().createStatement();
              ResultSet rset = stmt.executeQuery("Select do.link_verbage, do.link_url from dw_user_group dug, dw_profile_object dpo, dw_object do where dug.user_id='AMAHAJAN' and dug.group_id=dpo.group_id and dpo.object_id=do.object_id and do.app_type_code='A' order by do.link_verbage");
              while (rset.next()) {
    System.out.println(rset.getString("LINK_VERBAGE"));
    hashMapValues.put(rset.getString("link_Verbage"), rset.getString("link_url"));
              stmt.close();
              return hashMapValues;
         public static void main(String args[]) throws SQLException {
         DisplayLinkUrls displayLinkUrl = new DisplayLinkUrls();
    for(String url : displayLinkUrl.getDispalyLinkUrls().keySet()) {
    System.out.println(url);
    // System.out.println(displayLinkUrl.getDispalyLinkUrls().get(url));
    Please suggest me.
    Many Thanks!!

  • Converting from JAVA HASHMAP to PLSQL object or CLOB

    Hello All,
    My oracle version in 10.2.0.4 on a solaris V880 machine.
    Our Application Java SDK is 1.4.
    I am trying to pass in a series of XML (considerably huge for XML type column) from java application plsql which stores them into an oracle table with column as external BLOB. Since the contents are so heavy for each objects , using XMLTYPE column is not feasible.
    The xml files comes as either java hash_map or string which i have to pass as parameter to an Oracle stored procedure which stores as external BLOB in OS through a table.
    My first doubt is this the correct approach.
    My second doubt here is how to interpret java hash_map object within PLSQL when it is passed to it.
    Apologies if the question is silly since i am a new comer to java.
    Thanks in advance ,
    Vijay G

    vijay S P G wrote:
    If i have plsql collection with a varchar2 and a blob as record type then can i directly pass the java hash map to the procedure having parameter datatype as the above said record type ?Of course not. Obviously the first reason for that is because the "blob" needs to be a file path and not a blob.
    Second reason is no databases that I know of take a hash data type. Some take arrays. But I doubt that is worth the trouble.
    You have a collection of name value (path) pairs. Iterate over the collection and for each name do an insert of the name and path.

  • Using a hashmap for caching -- performance problems

    Hello!
    1) DESCRIPTION OF MY PROBLEM:
    I was planing to speed up computations in my algorithm by using a caching-mechanism based on a Java HashMap. But it does not work. In fact the performance decreased instead.
    My task is to compute conditional probabilities P(result | event), given an event (e.g. "rainy day") and a result of a measurement (e.g. "degree of humidity").
    2) SITUATION AS AN EXCERPT OF MY CODE:
    Here is an abstraction of my code:
    ====================================================================================================================================
    int numOfevents = 343;
    // initialize cache for precomputed probabilities
    HashMap<String,Map<String,Double>> precomputedProbabilities = new HashMap<String,Map<String,Double>>(numOfEvents);
    // Given a combination of an event and a result, test if the conditional probability has already been computed
    if (this.precomputedProbability.containsKey(eventID)) {
    if (this.precomputedProbability.get(eventID).containsKey(result)) {
    return this.precomputedProbability.get(eventID).get(result);
    } else {
    // initialize a new hashmap to maintain the mappings
    Map<String,Double> resultProbs4event = new HashMap<String,Double>();
    precomputedProbability.put(eventID,resultProbs4event);
    // unless we could use the above short-cut via the cache, we have to really compute the conditional probability for the specific combination of the event and result
    * make the necessary computations to compute the variable "condProb"
    // store in map
    precomputedProbabilities.get(eventID).put(result, condProb);
    ====================================================================================================================================
    3) FINAL COMMENTS
    After introducing this cache-mechanism I encountered a severe decrease in performance of my algorithm. In total there are over 94 millions of combinations for which the conditional probabilities have to be computed. But there is a lot of redundancy in this set of feasible combinations. Basically it can be brought down to just about 260.000 different combinations that have to be captured in the caching structure. Therefore I expected a significant increase of the performance.
    What do I do wrong? Or is the overhead of a nested HashMap so severe? The computation of the conditional probabilities only contains basic operations.
    Only for those who are interested in more details
    4) DEEPER CONSIDERATION OF THE PROCEDURE
    Each defined event stores a list of associated results. These results lists include 7 items on average. To actually compute the conditional probability for a combination of an event and a result, I have to run through the results list of this event and perform an Java "equals"-operation for each list item to compute the relative frequency of the result item at hand. So, without using the caching, I would estimate to perform on average:
    7 "equal"-operations (--> to compute the number of occurences of this result item in a list of 7 items on average)
    plus
    1 double fractions (--> to compute a relative frequency)
    for 94 million combinations.
    Considering the computation for one combination (event, result) this would mean to compare the overhead of the look-up operations in the nested HashMap with the computational cost of performing 7 "equal' operations + one double fration operation.
    I would have expected that it should be less expensive to perform the lookups.
    Best regards!
    Edited by: Coding_But_Still_Alive on Sep 10, 2008 7:01 AM

    Hello!
    Thank you very much! I have performed several optimization steps. But still caching is slower than without caching. This may be due to the fact, that the eventID and results all share long common prefixes. I am not sure how this affects the computation of the values of the hash method.
    * Attention: result and eventID are given as input of the method
    Map<String,Map<String,Double>> precomputedProbs = new HashMap<String,Map<String,Double>>(1200);
    HashMap<String,Double> results2probs = (HashMap<String,Double>)this.precomputedProbs.get(eventID);
    if (results2Probs != null) {
           Double prob = results2Probs.get(result);
           if (prob != null) {
                 return prob;
    } else {
           // so far there are no conditional probs for the annotated results of this event
           // initialize a new hashmap to maintain the mappings
           results2Probs = new HashMap<String,Double>(2000);
           precomputedProbs.put(eventID,results2Probs);
    * Later, in case of the computation of the conditional probability... use the initialized map to save one "get"-operation on "precomputedProbs"
    // the variable results2probs still holds a reference to the inner HashMap<String,Double> entry of the HashMap  "precomputedProbs"
    results2probs.put(result, condProb);And... because it was asked for, here is the computation of the conditional probability in detail:
    * Attention: result and eventID are given as input of the method
    // the computed conditional probabaility
    double condProb = -1.0;
    ArrayList resultsList = (ArrayList<String>)this.eventID2resultsList.get(eventID);
    if (resultsList != null) {
                // listSize is expected to be about 7 on average
                int listSize = resultsList.size(); 
                // sanity check
                if (listSize > 0) {
                    // check if given result is defined in the list of defined results
                    if (this.definedResults.containsKey(result)) { 
                        // store conditional prob. for the specific event/result combination
                        // Analyze the list for matching results
                        for (int i = 0; i < listSize; i++) {
                            if (result.equals(resultsList.get(i))) {
                                occurrence_count++;
                        if (occurrence_count == 0) {
                            condProb = 0.0;
                        } else {
                            condProb = ((double)occurrence_count) / ((double)listSize);
                        // the variable results2probs still holds a reference to the inner HashMap<String,Double> entry of the HashMap  "precomputedProbs"
                        results2probs.put(result, condProb);
                        return condProb;
                    } else {
                        // mark that result is not part of the list of defined results
                        return -1.0;
                } else {
                    throw new NullPointerException("Unexpected happening. Event " + eventID + " contains no result definitions.");
            } else {
                throw new IllegalArgumentException("unknown event ID:"+ eventID);
            }I have performed tests on a decreased data input set. I processed only 100.000 result instances, instead of about 250K. This means there are 343 * 100K = 34.300K = 34M calls of my method per each iteration of the algorithm. I performed 20 iterations. With caching it took 8 min 5 sec, without only 7 min 5 sec.
    I also tried to profile the lookup-operations for the HashMaps, but they took less than a ms. The same as with the operations for computing the conditional probability. So regarding this, there was no additional insight from comparing the times on ms level.
    Edited by: Coding_But_Still_Alive on Sep 11, 2008 9:22 AM
    Edited by: Coding_But_Still_Alive on Sep 11, 2008 9:24 AM

  • 1.6.0_10 and 11, Memory leak returning variables from Java to JavaScript

    Environment: Windows XP SP2, IE7, JScript 5.7, JRE 1.6.0_11-b03 and 1.6.0_10
    Memory allocated in Java and returned as a JavaScript variable value is not garbage collected in Java when the JavaScript variable is re-used.
    In the following simplified example, a populated HashMap is returned from the applet test1 method to the JavaScript variable hash1.
    The JavaScript variable hash1 is re-used on the next iteration so I would expect it should be marked for garbage collection.
    In 1.6.0_7 and previous releases, the memory associated with this Java HashMap is freed implicitly.
    In 1.6.0_10 and 1.6.0_11 the HashMap memory is never freed.
    Is this is what we should expect, a feature of the significant LiveConnect changes that were part of 1.6.0_10?
    Do we need to rewrite our code to call new Java methods from JavaScript explicitly freeing the memory, in this example calling the freeMem method?
    Has anybody else experienced this problem since 1.6.0_10?
    Thanks
    Rob
    Example code ...
    TestRLApplet.java
    import java.applet.Applet;
    import java.util.HashMap;
    public class TestRLApplet extends Applet
    private HashMap hash1;
    public TestRLApplet()
    public void init()
    public HashMap test1()
    hash1 = new HashMap();
    for (int i = 0; i <10; i++) {
    hash1.put(Integer.toString(i),Integer.toString(i));
    return (hash1);
    public void freeMem() {
    hash1.clear();
    hash1 = null;
    TestClient.htm
    <HEAD>
    <TITLE></TITLE>
    <SCRIPT LANGUAGE="javascript">
    function window_onload()
    var hash1;
    testAppplet = document.TestRLApplet;
    for (cnt=0; cnt < 1000; cnt++)
    hash1= testAppplet.test1();
    </SCRIPT>
    </HEAD>
    <object
    classid = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    WIDTH = 1 HEIGHT = 1 NAME = "TestRLApplet" >
    <PARAM NAME = CODE VALUE = "TestRLApplet.class" >
    <PARAM NAME = ARCHIVE VALUE = "../applets/TestRLApplet.jar" >
    <PARAM NAME = NAME VALUE = "TestRLApplet" >
    <PARAM NAME = MAYSCRIPT VALUE = true >
    <param name = "type" value = "application/x-java-applet;version=1.6">
    <param name = "scriptable" value = "false">
    </object>
    <BODY LANGUAGE=javascript onload="return window_onload()" leftMargin=40 id=body >
    </BODY>
    </HTML>
    Java Console
    Java Plug-in 1.6.0_10
    Using JRE version 1.6.0_10 Java HotSpot(TM) Client VM
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    Memory: 5,056K Free: 2,551K (50%) ... completed.
    Memory: 7,996K Free: 3,499K (43%) ... completed.
    Memory: 7,996K Free: 1,038K (12%) ... completed.
    Memory: 13,180K Free: 3,745K (28%) ... completed.
    Memory: 22,844K Free: 5,614K (24%) ... completed.
    Memory: 37,984K Free: 15,009K (39%) ... completed.
    Memory: 37,984K Free: 13,069K (34%) ... completed.
    Memory: 37,984K Free: 6,125K (16%) ... completed.
    Memory: 65,088K Free: 25,107K (38%) ... completed.
    Memory: 65,088K Free: 21,201K (32%) ... completed.
    Memory: 65,088K Free: 13,381K (20%) ... completed.
    Memory: 65,088K Free: 7,967K (12%) ... completed.
    Memory: 65,088K Free: 5,013K (7%) ... completed.
    Memory: 65,088K Free: 414K (0%) ... completed.

    What are you missing?
    I inherited this app and signing the third party jars is how it was setup, I was wondering the same thing too, why was it necessary to sign the third party jars?
    The applet runs in either JRE 1.6.0_13 or JRE 1.6.0_27 depending on the other Java apps the user uses. JRE 1.6.0_13 does not have the mixed code security (so it is like is disable), but JRE 1.6.0_27 does have the mixed code security and the applet will not launch with mixed code security enable, so we have to disable it. With all the hacking going on in the last two years, is important to improve security; so this is a must.
    Yes, I always clear up the cache.
    Any idea on how to resolve this problem?

  • Java.util.Map to flash.utils.Dictionary

    Hi,
    I'm using Blazeds for my remoting between Flex and Java. I have an Object-to-object map on the Java side. This converts to an untyped Object in Flex having the properties as the 'toString' of the key Object.
    Has anyone been able to convert an Object-to-object java map to a flash Dictionary object? Why wouldn't it do that as default?
    Thanks,
    Eyal

    Yes, You can, I have successfully mapping form java HashMap to Flex Dictionary. The following is the code fragment for the success case:
    The hint is that you need to use ObjectProxy in Flex to map HashMap in Java.
    Man Pak Hong, Dave
    Analyst Programmer
    [email protected]
    manpakhong
    Java:
    // ================================================================================
        public Map<String, Object> getCaseDetails(Long sid) throws ApplicationException, SystemException {
            // Vos Declaration
            Case caseVo = null;
            UserInfo ossUserInfoVo = null;
            UserInfo spUserInfoVo = null;
            Ngo ossNgoVo = null;
            Ngo spNgoVo = null;
            Personal personalVo = null;
            Contact contactVo = null;
            CaseAttachment caseAtthVo = null;
            Office ossOffice = null;
            SwdOffice swdOffice = null;
            UserInfo swdEao = null;
            NeedAssess needAssess = null;
            List <CaseRegPropVw> caseRegPropVwList = null;       
            CaseDao daoCase = new CaseDao();       
            caseVo = daoCase.getCase(sid);
            if (caseVo != null)
                UserInfoDao daoUserInfo = new UserInfoDao();
                ossUserInfoVo = daoUserInfo.getUserInfo(caseVo.getOssCmSid());
                spUserInfoVo = daoUserInfo.getUserInfo(caseVo.getNgoCmSid());
                // caseRegProp
                CaseRegPropVwDao daoCaseRegPropVw = new CaseRegPropVwDao();
                caseRegPropVwList = daoCaseRegPropVw.listCaseRegPropVwByLessRegNo(caseVo.getLessRegNo());           
            NgoDao daoNgo = new NgoDao();
            if (ossUserInfoVo != null)
                ossNgoVo = daoNgo.getNgo(ossUserInfoVo.getNgoSid());
            if (spUserInfoVo != null)
                spNgoVo = daoNgo.getNgo(spUserInfoVo.getNgoSid());
            // personal
            if (caseVo != null)
                PersonalDao daoPersonal = new PersonalDao();
                personalVo = daoPersonal.getPersonal(caseVo.getPersonalSid());
                // jscontact
                ContactDao daoContact = new ContactDao();
                contactVo = daoContact.getContact(caseVo.getSid());
                // ossCaseAtth
                CaseAttachmentDao daoCaseAtth = new CaseAttachmentDao();
                caseAtthVo = daoCaseAtth.getCaseAttachment(caseVo.getSid(), CaseAttachmentPolicy.ATT_TYPE_CONSENT_FORM);
                // ossOffice
                OfficeDao daoOssOffice = new OfficeDao();
                ossOffice = daoOssOffice.getOffice(caseVo.getOssOfficeSid());
            if (personalVo != null)
                // swdOffice
                SwdOfficeDao daoSwdOffice = new SwdOfficeDao();
                swdOffice = daoSwdOffice.getSwdOffice(personalVo.getSwdOfficeSid());
                // swdEao
                UserInfoDao daoSwdEao = new UserInfoDao();
                swdEao = daoSwdEao.getUserInfo(personalVo.getSwdEaoSid());
                // needAssess
                NeedAssessDao daoNeedAssess = new NeedAssessDao();
                needAssess = daoNeedAssess.getNeedAssess(personalVo.getSid());
            Map<String, Object> hm = new HashMap<String, Object>();
            hm.put("Case", caseVo);
            hm.put("OssUserInfo", ossUserInfoVo);
            hm.put("NgoUserInfo", spUserInfoVo);
            hm.put("OssNgo", ossNgoVo);
            hm.put("SpNgo", spNgoVo);
            hm.put("Personal", personalVo);
            hm.put("Contact", contactVo);
            hm.put("CaseAtth", caseAtthVo);
            hm.put("OssOffice", ossOffice);
            hm.put("SwdOffice", swdOffice);
            hm.put("SwdEao", swdEao);
            hm.put("NeedAssess", needAssess);
            hm.put("CaseRegPropsVw", caseRegPropVwList);
            return hm;
    Flex part
    // ==================================================================================
                // CASEDETAILS
                private function getCaseDetailsResultHandler(result:ObjectProxy):void
                    var dc:ObjectProxy = result;
                    this.editItemOssUserInfo = dc["OssUserInfo"];
                    detailCaseInfo.editItemOssUserInfo = editItemOssUserInfo;
                    this.editItemOssNgo = dc["OssNgo"];
                    detailCaseInfo.editItemOssNgo = editItemOssNgo;   
                    this.editItemCase = dc["Case"];       
                    detailCaseInfo.editItemCase = editItemCase;
                    detailPersonalInfo.editItemCase = editItemCase;   
                    this.editItemPersonal = dc["Personal"];
                    detailCaseInfo.editItemPersonal = editItemPersonal;
                    detailPersonalInfo.editItemPersonal = editItemPersonal;
                    this.editItemContact = dc["Contact"];
                    detailCaseInfo.editItemContact = editItemContact;
                    detailPersonalInfo.editItemContact = editItemContact;
                    this.editItemCaseAtth = dc["CaseAtth"];
                    detailCaseInfo.editItemCaseAtth = editItemCaseAtth;
                    this.editItemOssOffice = dc["OssOffice"];
                    detailCaseInfo.editItemOssOffice = editItemOssOffice;
                    this.editItemSwdOffice = dc["SwdOffice"];
                    detailCaseInfo.editItemSwdOffice = editItemSwdOffice;
                    this.editItemSwdEao = dc["SwdEao"];
                    detailCaseInfo.editItemSwdEao = editItemSwdEao;
                    this.editItemNeedAssess = dc["NeedAssess"];
                    detailCaseInfo.editItemNeedAssess = editItemNeedAssess;
                    this.listItemCaseRegPropVw = dc["CaseRegPropsVw"];
                    this.caseDict = new Dictionary();               
                    caseDict[CaseDetailPolicy.INIT_OSSUSERINFO] = editItemOssUserInfo;
                    caseDict[CaseDetailPolicy.INIT_OSSNGO] = editItemOssNgo;
                    caseDict[CaseDetailPolicy.INIT_CASE] = editItemCase;
                    caseDict[CaseDetailPolicy.INIT_PERSONAL] = editItemPersonal;
                    caseDict[CaseDetailPolicy.INIT_CONTACT] = editItemContact;
                    caseDict[CaseDetailPolicy.INIT_CASEATTH] = editItemCaseAtth;
                    caseDict[CaseDetailPolicy.INIT_OSSOFFICE] = editItemOssOffice;
                    caseDict[CaseDetailPolicy.INIT_SWDEAO] = editItemSwdEao;
                    caseDict[CaseDetailPolicy.INIT_NEEDASSESS] = editItemNeedAssess;               
                    // detailCaseInfo.init();

  • Java.util.Map as Parameter?

    hi!
    i use a Map as Parameter in a webserivce.
    in detail it's a hashMap<String,String>
    is this a recommend way?
    can any other client such as .net understand the wsdl?
    in the wsdl the map looks like : type="apachesoap:Map"
    thanks a lot?

    You SHOULD NOT use the Java HashMap, I recomend you, to implement your own class to represent a Map, Specially if you have the server side implementation in Java and the client you are developing is implmented in C/C++/.NET, If you use yhe java HashMap you may have a lot of problems with serialization/deserialization e.j. something like HashMap:
    public class Kmap implements Serializable {
         public mapEntry map[];
         public int size;
         public Kmap() {
              map = null;
              size = 0;
         public Set KmapkeySet() {
              return this.toHashMap().keySet();
    public class mapEntry implements Serializable {
    private String key;
    private Alist value;
    public mapEntry(){
    key = null;
    value = null;
    public void setKey(String k){
    key = k;
    public String getKey(){
    return this.key;
    public void setValue(Alist l){
    value = l;
    public class Alist implements Serializable {
         private String [] dat;
         private int size;
         public Alist() {
              dat = null;
              size = 0;
         public void insert(String dato) {
              if (size == 0) {
                   dat = new String[1];
                   dat[0] = dato;
                   size++;
                   return;
              String [] aux = new String [size + 1];
              for (int i = 0; i < size; i++) {
                   aux[i] = dat;
              aux[size] = dato;
              dat = aux;
              size++;

  • Iterate through HashMap ?

    Hello,
    is it possible to iterate through a Java HashMap somehow?
    Or is there any other iterable data structure i could use (I need to get objects from the data structure by using an integer value as key ) ?
    thanks!

    It depends...
    Simple answer: you can use keySet() or values() to get respectively a Set or a Collection, then you iterate on them (using iterator()).
    But you have no guarantee on the order of iteration.
    Now, a data structure using an integer as key is commonly called... an array! Half joking, it works well if these integers are consecutive or of limited range.
    If you need to iterate in increasing key values, use a TreeMap.

  • Hashmap capacity planning

    Hi
    I am new to java forum,
    I am implementing java HashMap<String,String> hm= new HashMap<String,String>(capacity??,loadfactor??)
    Can someone help me to determine the formula for setting up capacity value and load factor value
    I am using Hashmap to store entries from range of 250K to 1.5 million records, Mostly I use feature of containsKey for each record to determine, if key is not present then add the (Key,Value)., Finally using Iterator to print all values stored in Hashmap.
    thanks in advance.

    My question is very specific to determining the capacity and load factor formula for known range of records tobe added in Hash map both with respect to memory utilisation and search speed and also best trade-off.
    Is there any formula/method?
    I have configured my jvm to use max and min 1GB memory to process application.

  • Out of memory error

    Hello all,
    I am newbie to this forum, so kindly excuse me if I am posting an incorrect question.
    My application goes down every week and the error logs point to java.lang.OutOfMemoryError.
    Analysed the sysout logs and heap logs : -
    Sysout logs :
    Could not invoke the service() method on servlet action. Exception thrown : java.lang.OutOfMemoryError
         at oracle.jdbc.driver.OracleStatement.prepareAccessors(OracleStatement.java(Compiled Code))
         at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java(Compiled Code))
         at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java(Compiled Code))
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java(Compiled Code))
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java(Compiled Code))
         at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java(Compiled Code))
         at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.pmiExecuteQuery(WSJdbcPreparedStatement.java(Compiled Code))
         at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.executeQuery(WSJdbcPreparedStatement.java(Compiled Code))
         at xxx.cis.tuf.server.connector.jdbc.v1.JDBCv1DBStatement.executeQuery(JDBCv1DBStatement.java(Compiled Code))
         at xxx.myapplication.dao.Person.loadRecord(Person.java(Compiled Code))
         at xxx.myapplication.SiteUtil.getUserJavaLocale(SiteUtil.java(Compiled Code))
         at xxx.myapplication.updateprofile.actions.UpdateProfileAction.execute(UpdateProfileAction.java:56)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java(Inlined Compiled Code))
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java(Compiled Code))
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java(Inlined Compiled Code))
         at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java(Compiled Code))
         at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
         at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
         at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java(Compiled Code))
         at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java(Compiled Code))
         at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java(Compiled Code))
         at xxx.myapplication.UTF8Filter.doFilter(UTF8Filter.java(Compiled Code))
         at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java(Compiled Code))
         at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java(Compiled Code))
         at xxx.cis.tuf.server.filter.TUFExtendedFilterChainImpl.doFilter(TUFExtendedFilterChainImpl.java(Compiled Code))
         at xxx.cis.tuf.server.directory.GroupModifixxxionEventFilter.doFilter(GroupModifixxxionEventFilter.java(Compiled Code))
         at xxx.cis.tuf.sys.server.filter.TUFFilterChainImpl.doFilter(TUFFilterChainImpl.java(Inlined Compiled Code))
         at xxx.cis.tuf.server.filter.TUFExtendedFilterChainImpl.doFilter(TUFExtendedFilterChainImpl.java(Compiled Code))
         at xxx.cis.tuf.server.security.SecurityFilter.doFilter(SecurityFilter.java(Compiled Code))
         at xxx.cis.tuf.sys.server.filter.TUFFilterChainImpl.doFilter(TUFFilterChainImpl.java(Inlined Compiled Code))
         at xxx.cis.tuf.server.filter.TUFExtendedFilterChainImpl.doFilter(TUFExtendedFilterChainImpl.java(Compiled Code))
         at xxx.cis.tuf.server.security.cws.CWSSecurityTokenContextFilter.doFilter(CWSSecurityTokenContextFilter.java(Compiled Code))
         at xxx.cis.tuf.sys.server.filter.TUFFilterChainImpl.doFilter(TUFFilterChainImpl.java(Inlined Compiled Code))
         at xxx.cis.tuf.server.filter.TUFExtendedFilterChainImpl.doFilter(TUFExtendedFilterChainImpl.java(Compiled Code))
         at xxx.cis.tuf.server.logging.LoggingRequestIDFilter.doFilter(LoggingRequestIDFilter.java(Compiled Code))
         at xxx.cis.tuf.sys.server.filter.TUFFilterChainImpl.doFilter(TUFFilterChainImpl.java(Compiled Code))
         at xxx.cis.tuf.server.filter.TUFExtendedFilterChainImpl.doFilter(TUFExtendedFilterChainImpl.java(Inlined Compiled Code))
         at xxx.cis.tuf.server.filter.TUFMasterFilter.doFilter(TUFMasterFilter.java(Compiled Code))
         at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java(Compiled Code))
         at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java(Compiled Code))
         at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java(Compiled Code))
         at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java(Compiled Code))
         at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java(Compiled Code))
         at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java(Compiled Code))
         at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java(Compiled Code))
         at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java(Compiled Code))
         at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java(Compiled Code))
         at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java(Compiled Code))
         at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java(Compiled Code))
         at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java(Compiled Code))
         at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java(Compiled Code))
         at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java(Compiled Code))
         at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))
    The analysis of heap dump shows :-
    35,548,944 (29%) [32] 2 java/util/Hashtable$Entry 0x17e998f8
    35,548,888 (29%) [232] 15 com/ibm/ws/rsadapter/spi/WSRdbManagedConnectionImpl 0x128a8c40
    35,084,008 (28%) [24] 1 array of javax/resource/spi/ConnectionEventListener 0x128a8128
    35,083,984 (28%) [16] 1 com/ibm/ejs/j2c/ConnectionEventListener 0x128a7af8
         35,083,968 (28%) [224] 13 com/ibm/ejs/j2c/MCWrapper 0x161ccf50
         34,547,384 (28%) [24] 1 com/ibm/ejs/j2c/poolmanager/MCWrapperList 0x120ea638
         34,547,360 (28%) [216] 42 array of java/lang/Object 0x120ea558
              1,105,160 (0%) [224] 9 com/ibm/ejs/j2c/MCWrapper 0x1251fb88
              1,065,552 (0%) [224] 9 com/ibm/ejs/j2c/MCWrapper 0x1022c780
              1,061,056 (0%) [224] 9 com/ibm/ejs/j2c/MCWrapper 0x107157a0
              1,042,776 (0%) [224] 9 com/ibm/ejs/j2c/MCWrapper 0x148ab790
                   1,038,656 (0%) [224] 9 com/ibm/ejs/j2c/MCWrapper 0x168fbb30
                   1,000,784 (0%) [224] 9 com/ibm/ejs/j2c/MCWrapper 0x108cec00
                   There are 22 more children
    My analysis is that hashtable is causing this issue.
    In my application I am using hashmap to store resultset objects and use request.setAttribute("databasevaluesforuser", databasevalues) to show in jsp.
    Could it be that after the values are displayed the hashmap still contains those objects and when multiple users
    access the application, heap size increases and this causes out of memory issues. I also paginated some jsp so that users view part by part of the results from database and thus prevent memory outage.
    Could anybody help me in this issue. Please inform me if I need to provide any further information.

    Aplogies for answering late.
    I am using SUN 1.4 jvm
    The analysis of GC logs showed that lot of memory is consumed by java hashmap. In my application I am using hash map only to store the results from database and then represent at jsp using the request parameter.

  • Try to use J2SE Version 6 with Oracle E-Business Suite 11i

    Dears ,
    i have an upgrade task from 11.5.10.2 to R12.1.1 and database from 9.2.0.8 to 11.2
    so i apply patches :
    1- 7429271
    2- Upgrading Developer 6i with Oracle Applications 11i [ID 125767.1]
    3- 9535311
    4- 6241631
    5-upgrade to JRE : Using J2SE Version 6 with Oracle E-Business Suite 11i [ID 401561.1]
    when i run :
    txkrun.pl -script=SetJDKCfg -contextfile=$CONTEXT_FILE -runautoconfig=Yes -appspass= <APPS_schema_passwd> -jdktop=[JDK60_TOP]
    faced error :
    java.lang.NoClassDefFoundError: java/util/HashMap
    at
    at oracle.apps.ad.tools.configuration.Customizer.getProdTopDrivers(Compiled Code)
    at oracle.apps.ad.tools.configuration.Customizer.getAllDrivers(Compiled Code)
    at oracle.apps.ad.tools.configuration.VersionConflictListGenerator.getAllConflicts(Compiled Code)
    at oracle.apps.ad.tools.configuration.VersionConflictListGenerator.main(Compiled Code)
    Exception in thread "main" Using Context file : /vol3/oracle/prdappl/admin/PRD_mcd-test.xml
    Context Value Management will now update the Context file
    and when try to run autoconfig on APPSTier i faced :
    java.lang.NoClassDefFoundError: java/util/HashMap
    at
    at oracle.apps.ad.tools.configuration.Customizer.getProdTopDrivers(Compiled Code)
    at oracle.apps.ad.tools.configuration.Customizer.getAllDrivers(Compiled Code)
    at oracle.apps.ad.tools.configuration.VersionConflictListGenerator.getAllConflicts(Compiled Code)
    at oracle.apps.ad.tools.configuration.VersionConflictListGenerator.main(Compiled Code)
    Exception in thread "main" ERROR: Version Conflicts utility failed.
    Terminate.
    how can i solve it .
    your response will be highly appreciated
    Regards ,,,
    Mohamed Mahgob

    Please see these docs.
    Creating "appsutl.zip" Failed On "java.lang.NoClassDefFoundError: java/util/HashMap", What is the Potential Solution ? [ID 1310838.1]
    AdMKAppsUtil.pl Failing Can't Find Java HashMap [ID 1338399.1]
    After Applying Patch 9535311 Get java.lang.NoClassDefFoundError: java/util/HashMap Error [ID 1188327.1]
    Thanks,
    Hussein

Maybe you are looking for