Access values stored in 2D Array in HashMap

Hi everyone i would like to know how to access values stored in a 2D array inside a HashMap
Here is a drawing representation of the map.
So to get the KEYS I just have to execute this code:
this.allPeople = personInterests.keySet();But how can I get acces to the actual values inside the 2D Array?
My goal is to create a treeSet and store all the elements of the first array in it, then look at the second array if any new elements are detected add them to the treeset, then third array and so on.
I tried this code:
Object[] bands = personInterests.values().toArray();
     for( int i=0; i<bands.length; i++)
          this.allBands.add(bands.toString());
}But this.allBands.add(bands[i].toString())seems to be the problem, Dealing with a 2D array, this code only return a string representation of the Arrays and not a string representation of their elements.
Using my logic I tried to execute:
   this.allBands.add(bands[0][i].toString());But i get a ARRAY REQUIRED BUT JAVA.LANG.OBJECT FOUND
I really don't know the way to go.
Thanks to anyone that will help.
Regards, Damien.
Edited by: Fir3blast on Mar 3, 2010 5:27 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

You'll just need to cast the object to the correct type. This is nothing to do with HashMap at all. If you don't know what that means then your google keywords are "java cast tutorial".

Similar Messages

  • Accessing values in multi-dimensional arrays

    Hello, I created a 2 dimensioned array, not sure if it is done in the correct way but it works like this:
    var arrLines:Array = new Array(new Array());
    arrLines.pop(); // because it creates an empty value to begin with
    Anyway, I am not sure how to access individual values within this array.
    arrLines.push([100, 200],[300, 400]); // creates 2 compartments each with 2 sub compartments
    trace(arrLines[0]); //displays 100, 200
    How would I make it trace only 100 OR 200?
    Thanks.

    use:
    var arrLines:Array = new Array();
    //arrLines.pop(); // because it creates an empty value to begin with
    arrLines.push([100, 200],[300, 400]); // creates 2d array
    trace(arrLines[0][0]); //displays 100
    trace(arrLines[0][1]); //200
    trace(arrLines[1][0]); //300
    trace(arrlines[1][1]); //400
    Thanks.

  • Access values stored in pointer

    I am using oracle xml parser to parse an xml.The code below prints the elements and data from a xml file.
    static XMLSAX_CHARACTERS_F(characters, ctx, ch, len)
         saxctx *sc = (saxctx *) ctx;
            printf("Element : %s\n",sc->elem);
         printf("Data : %s\n",ch);
        return 0;
    }I want to use the data pointed by sc->elem and ch in another function.
    I defined a global variable and passed the values to them but it is not working.
    any help appreciated
    Edited by: Rameshkumar T on Mar 11, 2011 5:24 PM
    Edited by: Rameshkumar T on Mar 11, 2011 5:25 PM
    Edited by: Rameshkumar T on Mar 11, 2011 5:26 PM

    The sample xml file which is parsed
    <Zipcodes>
    <STATE_ABBREVIATION>CA</STATE_ABBREVIATION>
    <ZIPCODE>94301</ZIPCODE>
    <CITY>Palo Alto</CITY>
    </Zipcodes>
    The code parses the XML using oracle SAX parser.
    typedef struct
    char *xml_value;
    char *xml_element;
    int xml_length;
    }xml_data;
    xml_data *xml_ptr;
    short process_record (void)
    parse_xml(column->column_value,column->actual_value_length);
    puts("after parse");
    for (tmeta_ptr = trg_meta,xml_ptr; strcmp (tmeta_ptr->column_name,xml_ptr->xml_element); tmeta_ptr++;xml_ptr++);
    printf("Element : %s\n",xml_ptr->xml_element);
    printf("Data : %s\n",xml_ptr->xml_value);
    static XMLSAX_CHARACTERS_F(characters, ctx, ch, len)
    saxctx sc = (saxctx ) ctx;
    if(!ch)     
    output_msg("Element : %s\n",sc->elem);
    output_msg("Data : %s\n",ch);
    xml_ptr->xml_element=sc->elem;
    xml_ptr->xml_value= (char *)malloc(len*sizeof(char)+1);
    strcpy(xml_ptr->xml_value,ch);
    xml_ptr->xml_length=len;
    printf("data:%s\n",xml_ptr->xml_value);
    xml_ptr++;
    return 0;
    static xmlsaxcb saxcb = {
    startDocument,
    endDocument,
    startElement,
    endElement,
    characters
    int parse_xml(char *addr_buf,int buf_len )
    xmlctx *xctx;
    saxctx sc;
    xmlerr ecode;
    puts("Creating XML context...");
    if (!(xctx = XmlCreate(&ecode, (oratext *) "saxsample_xctx", NULL)))
    output_msg("Failed to create XML context, error %u\n", (unsigned) ecode);
    return 1;
    output_msg("Parsing XML ...\n");
    if (ecode = XmlLoadSax(xctx, &saxcb, &sc, "buffer", addr_buf, "buffer_length", buf_len,
    "validate", TRUE, "discard_whitespace", TRUE, NULL))
    return 1;
    XmlDestroy(xctx);     /* terminate XML package */
    return 0;
    The SAX parser does a callback to XMLSAX_CHARACTERS_F
    The definition points to the lines below in the header file
    #define XMLSAX_CHARACTERS_F(func, ctx, ch, len) \
    xmlerr func(void ctx, oratext ch, size_t len)
    XMLSAX_CHARACTERS_F((*XMLSAX_CHARACTERS_CB), ctx, ch, len);
    That again points to
    #define XMLSAX_CHARACTERS_CB XmlSaxCharacters_xmlsaxcb
    The XmlLoadSax does a callback to the XmlSaxCharacters to fetch the data between the xml tags .
    The sample output for the code
    XML C SAX sample
    Creating XML context...
    Parsing XML ...
    startDocument
    Element : STATE_ABBREVIATION
    Data : CA
    It crashes here !!!!!

  • Finding the average of all the values stored in a two dimentional array

    public int avg(int[][] numbers2){
        int sum = 0;
        float avg = 0;
        for(int r = 0; r < numbers2.length; r++)
          for(int c = 0; c < numbers2[r].length; c++){
              sum += numbers2[r][c];
          }So I have this code that of course finds the sum of all the values stored in the array int[][] numbers. What I am having an issue with is finding the average of the numbers. When I attempt to use:
    avg = sum / numbers2.length; I get the sum / 3 because my array looks like:
    int[][] numbers2 = {{1, 2, 3},
                                {4, 5, 6},
                                {7, 8, 9}
                                          };Any ideas on what I should do or where I could find information on this process?

    2 dimensional arrays have 2 lengths:
    myArray.length and myArray[0].length
    The first one I believe is fixed, the second one may vary from row to row. But if you know that it won't vary, then you can just use the [0] row length.

  • How can i asign value to variables stored in an array of string?

    hi
    how can i asign value to variables stored in an array of string. i need to do it so that i can evaluate a math expression by usin those values. for example, i have a string array like [x, y, z, k]. now i need to asign 2.0 to x, 3.0 to y and so on. then if i type x+y, the program should evaluate the expression by usin x=2.0 and y=3.0. i am usin JEP for parsing and evaluating.
    any help or suggestion would be much apreciated.
    here is how i got the array
    System.out.println("Type first expression");
    BufferedReader br1 = new BufferedReader( new
                         InputStreamReader(System.in));
    String expression1 = br1.readLine();
    Jep jep = new Jep();
    Node node1 = jep.parse(expression1);
    TreeAnalyzer Ta1 = new TreeAnalyzer(node1);
    Map<Variable, Integer> map1 = Ta1.getVariables();
    /**The following will convert the variable names to a sorted array*/
         /**with the result in varNames.*/
    String[] res1 = new String[map1.size()];
                int i=0;
                for(Variable v:map1.keySet())
                    res1[i++]=v.getName();  
    System.out.println(Arrays.toString(res1));

    I could not use HashMap as those variables are to be retrieved from any expression typed by user and thus unknown to me beforehand.
    System.out.println("Type first expression");
    BufferedReader br1 = new BufferedReader( new
                         InputStreamReader(System.in));
    String expression1 = br1.readLine();
    Jep jep = new Jep();
    Node node1 = jep.parse(expression1);
    TreeAnalyzer Ta1 = new TreeAnalyzer(node1);
    Map<Variable, Integer> map1 = Ta1.getVariables();then i have converted them to a sorted array
    String[] res1 = new String[map1.size()];
                     int i=0;
                     for(Variable v:map1.keySet())
                         res1[i++]=v.getName();              
                     System.out.println(Arrays.toString(res1));now i need to assign random double values to those variables.
    and then use those double values for variables when evaluating the expression.
    pls help.

  • How to Print all values stored in an Associative array

    DB version:10gR2
    There can be multiple results(multiple rows) for the below query. So, i'll have to declare the variables v_sid_serial, v_orauser, v_objectname,v_objecttype as associative arrays.
    SELECT l.session_id||','||v.serial# sid_serial, l.ORACLE_USERNAME,o.object_name,o.object_type,
           into v_sid_serial, v_orauser, v_objectname,v_objecttype
    FROM dba_objects o, v$locked_object l, v$session v
    WHERE o.object_id = l.object_id
          and l.SESSION_ID=v.sid;But I want to store the results from the above query in flat file. I want the result set to look like
    SID_SERIAL      ORA_USER               OBJECT_NAME           
    742,32914    SCOTT                        EMP
    873,49832    HR                           EMPLOYEES
    893,9437     mytestschema                 emp_dtls
    .            .How can i print the values in Associative arrays in the above manner so that i can spool the result set to a flat file?
    Edited by: user10373231 on Sep 29, 2008 5:19 AM

    user10373231 wrote:
    is there any way to print all values stored in an Associative arrayPrint to where?
    You could use DBMS_OUTPUT to get the output on the screen within SQL*Plus.
    You could also output (pipe) the data from PL/SQL using a pipelined function that you select from SQL. An example of a pipelined function...
    SQL> CREATE OR REPLACE TYPE myrec AS OBJECT
      2  ( col1   VARCHAR2(10),
      3    col2   VARCHAR2(10)
      4  )
      5  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE TYPE myrectable AS TABLE OF myrec
      2  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE FUNCTION pipedata(p_str IN VARCHAR2) RETURN myrectable PIPELINED IS
      2    v_str VARCHAR2(4000) := REPLACE(REPLACE(p_str, '('),')');
      3    v_obj myrec := myrec(NULL,NULL);
      4  BEGIN
      5    LOOP
      6      EXIT WHEN v_str IS NULL;
      7      v_obj.col1 := SUBSTR(v_str,1,INSTR(v_str,',')-1);
      8      v_str := SUBSTR(v_str,INSTR(v_str,',')+1);
      9      IF INSTR(v_str,',')>0 THEN
    10        v_obj.col2 := SUBSTR(v_str,1,INSTR(v_str,',')-1);
    11        v_str := SUBSTR(v_str,INSTR(v_str,',')+1);
    12      ELSE
    13        v_obj.col2 := v_str;
    14        v_str := NULL;
    15      END IF;
    16      PIPE ROW (v_obj);
    17    END LOOP;
    18    RETURN;
    19  END;
    20  /
    Function created.
    SQL>
    SQL> create table mytab (col1 varchar2(10), col2 varchar2(10));
    Table created.
    SQL>
    SQL> insert into mytab (col1, col2) select col1, col2 from table(pipedata('(1,2),(2,3),(4,5)'));
    3 rows created.
    SQL>
    SQL> select * from mytab;
    COL1       COL2
    1          2
    2          3
    4          5... which you can easily adapt to output whatever data you want e.g. you could loop through your associative array and pipe out the values within it.

  • Array or Hashmap

    I'm planning on loading all of my data from a separate thread into a single variable. This variable needs to hold 18 character models 8 terrains and random objects. I was originally planning on separating these two categories into Hashmaps and then the put the two hashmaps into a single hashmap so that I may call them by name. I then decided to buy them into ArrayLists instead of hashmaps. Similar to all games i'm looking for the best performance I dropped the ArrayLists but wanted to know if I would get better performance from an dimensional Array, An Array of 2 arrays or Hashmap?
    Edited by: Bonechilla on Aug 23, 2009 9:54 AM

    For such a small number of items, it will be very difficult (and pointless) to measure a difference in performance between different implementations.
    But in answer to your question, I would advise building an interface for this collection describing how you want them to be stored and retrieved. i.e.
    public interface Models
        public abstract void add(String name, Model model);
        public abstract Model get(String name);
        public abstract int size();
    }Why? because then you can produce all these implementations and try them all out.
    For example using a HashMap:public class HashMapModels extends HashMap<String, Model>
            implements Models
    }or two ArrayLists:public class ArrayModels implements Models
        private ArrayList<String> names;
        private ArrayList<Model> models;
        public ArrayModels()
            names = new ArrayList<String>();
            models = new ArrayList<Model>();
        public void add(String name, Model model)
            names.add( name );
            models.add( model );
        public Model get(String keyName)
            int index = 0;
            for (String name : names) {
                if (name.equals( keyName )) {
                    return models.get( index );
                } else {
                    index++;
            return null;
        public int size()
            return models.size();
    }Out of the two above, the HashMap should be the fastest and be the easiest to maintain. But what will really aid you in performance is if the models are stored in separate collections; one for terrains, one for characters and another for random models.
    Perhaps:public class ModelStore
        private Models terrains;
        private Models characters;
        private Models objects;
        public Model getTerrain(String name)
            return terrains.get( name );
        public Model getCharacter(String name)
            return characters.get( name );
        public Model getObject(String name)
            return objects.get( name );
    }Now if you want to retrieve a terrain model you should only search through the 8 terrains and so skip the characters and random objects.
    You should also be thinking about what type of characteristics your collection needs. Presumably once it's loaded you will not be adding new elements to the collection, you will never insert models randomly into it (only adding to the end) and you will be performing lots of random access. If you can search by the models index (i.e. using an int) rather then it's name, then an array will easily be the fastest and all models could be stored in one big array. If your searching by name (or some other object used to identify the model) then I would recommend a TreeMap. Once all the items are added I'd guess it would give the best performance at searching for Models.
    But without profiling different ideas with real data, all of this is purely guesswork.

  • How to save a value in a byte array, retrieve it and display it?

    Hi,
    I am doing a project for my data structures class that involves saving a value (given in String format) in a byte array (our 'memory'). Initially I just tried casting character by character into the byte array and casting back to char[] for retrieval (using .toString() to return what's supposed to be the original string), but this did not work. I tried the .getBytes() method, applying it to the string and then trying to recover it by placing the contents of the 'memory' in a byte array and applying toString(), but that didn't work either. I looked a bit and found this class, CharsetEncoder and CharsetDecoder. I tried to use these but when I try the compiler tells me I cannot instantiate CharsetDecoder because it is an abstract class. At this point I'm at a loss as to what I can do. Is there any way to place a string in a byte array and then recover the string in it's original format? For example, I might save a value in my particular class of "456". But when I try to recover the value from my 'memory' i.e. the byte array, it comes out like [gnue@hnju.... or something similar. I need it to output the original string ("456").
    Below is my code as it is right now, for the methods setValue and getValue.
    Thanks!
    public void setValue(String value) throws InvalidValueException {
         //… stores the given value in the memory area assigned to the variable
              if(this.type.isValidValue(value)){
                   bytes = value.getBytes();
                   int i,j,k;
                   int l=0;//might be wrong?
                   int ad=address-(address%4);
                   mem.readWord(ad);
                   reg=mem.getDataRegister();
                   if((address%4)+bytes.length-1<4){
                        for(i=address%4;i<address%4+bytes.length;i++)
                             reg.setByte(i, bytes[i]);
                        mem.setDataRegister(reg);
                        mem.writeWord(ad);
                   else if((address%4)+bytes.length-1>=4){
                        if(address%4!=0){
                             for(i=address%4;i<4;i++){
                                  reg.setByte(i, bytes);
                                  l++;
                             mem.setDataRegister(reg);
                             mem.writeWord(ad);
                             ad+=mem.WORDSIZE;
                        while(ad<address+bytes.length-(address+bytes.length)%4){
                             for(j=0;j<4;j++){
                                  reg.setByte(j, bytes[j+l]);
                                  l++;
                             mem.setDataRegister(reg);
                             mem.writeWord(ad);
                             ad+=mem.WORDSIZE;
                        if((address+bytes.length)%4!=0){
                             mem.readWord(ad);
                             reg=mem.getDataRegister();
                             for(k=0;k<(address+bytes.length)%4;k++){
                                  reg.setByte(k, bytes[k+l]);
                                  l++;
                             mem.setDataRegister(reg);
                             mem.writeWord(ad);
                   else
                        throw new InvalidValueException("The value passed is not valid.");
         /** Gets the current value of the variable.
         @return current value converted to String
         public String getValue() {
              //… returns the current value stored in the corresponding memory area
              //… value is converted to String
              bytes=new byte[this.getType().getSize()];
              int i,j,k;
              int l=0;//might be wrong?
              int ad=address-(address%4);
              mem.readWord(ad);
              reg=mem.getDataRegister();
              if((address%4)+bytes.length-1<4){
                   for(i=address%4;i<address%4+bytes.length;i++)
                        bytes[i] = reg.readByte(i);
              else if((address%4)+bytes.length-1>=4){
                   if(address%4!=0){
                        for(i=address%4;i<4;i++){
                             bytes[i] = reg.readByte(i);
                             l++;
                        ad+=mem.WORDSIZE;
                   mem.readWord(ad);
                   reg=mem.getDataRegister();
                   while(ad<address+bytes.length-(address+bytes.length)%4){
                        for(j=0;j<4;j++){
                             bytes[j+l] = reg.readByte(j);
                             l++;
                        ad+=mem.WORDSIZE;
                   if((address+bytes.length)%4!=0){
                        mem.readWord(ad);
                        reg=mem.getDataRegister();
                        for(k=0;k<(address+bytes.length)%4;k++){
                             bytes[k+l] = reg.readByte(k);
                             l++;
              return bytes.toString();

    You can certainly put it into a byte array and then construct a new String from that byte array. Just calling toString doesn't mean you'll automatically get a meaningful string out of it. Arrays do not override the toString method, so the use the one inherited from object.
    Look at String's constructors.

  • How to get value stored in  javascript function and display in a JSP

    i am doing a questionaire which is for user to input data in every question, After user input the data, a javascript function will be called to do some score calculation. Since each question will carry its final score after the calculation by the javascript function, so i use an array to store those scores and then display those scores in the same page.
    However, i have to make a confirmation page to display both data and calculated score in another jsp, i only know how to display the data as it is a textfield that i can get the value by "request.getParameter("textfield1"); but i dun know how to get those scores as they are stored in an array in the javascript function, what way i can do??

    thank you for all your help!
    I have chosen to set the score value to the hidden field when every time run the function
    <script language="javascript">
    function cal(index){
    var thisForm = document.MC;
    thisForm.score1.value=score[index];//set value to the hidden field     
    </script>
    <input type="hidden" name="score1" value="">
    <input type="hidden" name="score2" value="">
    <input type="hidden" name="score3" value="">
    The function will calculate only one score when every time being called. So that i can only assign one score to one hidden value at a time.
    e.g, assign score[1] to thisForm.score1.value
    assign score[2] to thisForm.score2.value
    assign score[3] to thisForm.score3.value
    how can i do this??

  • Analysing waveform for digital values stored in a file

    i have certain digitals values obtained in a file in .txt format.
    i have to obtain a waveform by giving the input as these digital values in that file.
    I have programmed for array input manually.
    But the waveform analysis should be made such that it do analyze automatically by taking the values stored in the file.
    The values are stored as like follows-
    0.00159
    0.01432
    0.01654
    0.15432
    etc
    Give me a module to do this task.

    Use the Read from Spreadsheet file and then just connect it to a waveform chart. This will do what you need. Post back.

  • How to retrieve web service results that are stored in an array?

    Hi, everyone,
    I am using a manually created web service reference in APEX3.0.1 to call an external web service for a simple company search. Here is the WSDL:
    http://ws.strikeiron.com/DnBBusinessProspectLinkage2?WSDL
    The web referene is tested fine. And here is a sample test result:
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <Header xmlns="http://schemas.xmlsoap.org/soap/envelope/">
    <SubscriptionInfo xmlns="http://ws.strikeiron.com">
    <LicenseStatusCode>0</LicenseStatusCode>
    <LicenseStatus>Valid license key</LicenseStatus>
    <LicenseActionCode>7</LicenseActionCode>
    <LicenseAction>No hit deduction for invocation</LicenseAction>
    <RemainingHits>4921</RemainingHits>
    <Amount>0</Amount>
    </SubscriptionInfo>
    </Header>
    <soap:Body>
    <CompanySearchResponse xmlns="http://www.strikeiron.com">
    <CompanySearchResult>
    <ServiceStatus>
    <StatusNbr>213</StatusNbr>
    <StatusDescription>Successful search</StatusDescription>
    </ServiceStatus>
    <ServiceResult>
    <Count>2</Count>
    <CandidateCompanies>
    <CandidateCompany>
    <CompanyName>MSC SOFTWARE CORPORATION</CompanyName>
    <StreetAddress>2 MACARTHUR PL</StreetAddress>
    <City>SANTA ANA</City>
    <State>CA</State>
    <PostalCode>927075924</PostalCode>
    <Phone>7145408900</Phone>
    <CountryCode>US</CountryCode>
    <BranchIndicator>Headquarters</BranchIndicator>
    <TradingName />
    <ConfidenceCode>8</ConfidenceCode>
    <MatchGrade>BAAAAZZ</MatchGrade>
    <MatchNameGrade>Similar</MatchNameGrade>
    <MatchNamePercent>62</MatchNamePercent>
    <MatchStreetNumberGrade>Same</MatchStreetNumberGrade>
    <MatchStreetNumberPercent>100</MatchStreetNumberPercent>
    <MatchStreetNameGrade>Same</MatchStreetNameGrade>
    <MatchStreetNamePercent>100</MatchStreetNamePercent>
    <MatchCityGrade>Same</MatchCityGrade>
    <MatchCityPercent>100</MatchCityPercent>
    <MatchCountryStateGrade>Same</MatchCountryStateGrade>
    <MatchCountryStatePercent>100</MatchCountryStatePercent>
    <MatchPOBoxGrade>Not provided</MatchPOBoxGrade>
    <MatchPOBoxPercent>-1</MatchPOBoxPercent>
    <MatchPhoneGrade>Not provided</MatchPhoneGrade>
    <MatchPhonePercent>-1</MatchPhonePercent>
    </CandidateCompany>
    <CandidateCompany>
    <CompanyName>TYRA TECHNOLOGIES, INC</CompanyName>
    <StreetAddress>2 MACARTHUR PL</StreetAddress>
    <City>SANTA ANA</City>
    <State>CA</State>
    <PostalCode>927075924</PostalCode>
    <Phone>7145408900</Phone>
    <CountryCode>US</CountryCode>
    <BranchIndicator>Headquarters</BranchIndicator>
    <TradingName />
    <ConfidenceCode>8</ConfidenceCode>
    <MatchGrade>BAAAAZZ</MatchGrade>
    <MatchNameGrade>Similar</MatchNameGrade>
    <MatchNamePercent>62</MatchNamePercent>
    <MatchStreetNumberGrade>Same</MatchStreetNumberGrade>
    <MatchStreetNumberPercent>100</MatchStreetNumberPercent>
    <MatchStreetNameGrade>Same</MatchStreetNameGrade>
    <MatchStreetNamePercent>100</MatchStreetNamePercent>
    <MatchCityGrade>Same</MatchCityGrade>
    <MatchCityPercent>100</MatchCityPercent>
    <MatchCountryStateGrade>Same</MatchCountryStateGrade>
    <MatchCountryStatePercent>100</MatchCountryStatePercent>
    <MatchPOBoxGrade>Not provided</MatchPOBoxGrade>
    <MatchPOBoxPercent>-1</MatchPOBoxPercent>
    <MatchPhoneGrade>Not provided</MatchPhoneGrade>
    <MatchPhonePercent>-1</MatchPhonePercent>
    </CandidateCompany>
    </CandidateCompanies>
    </ServiceResult>
    </CompanySearchResult>
    </CompanySearchResponse>
    </soap:Body>
    </soap:Envelope>
    Here is my xpath defined in the report:
    /CompanySearchResponse/CompanySearchResult/ServiceResult/CandidateCompanies
    According to the WSDL file, the candidate companies are stored in an array. I am having problem to retrieve this values from the array. The web service ref is called but it returns nothing.
    Anyone in the forum can tell me what I did wrong?
    Thanks in advance!
    Jeff

    Hi, did you manage to figure this out? I'm having a similar problem with arrays.
    Also, i'm looking at how I can pass an array of values as input to the webservice call.. eg if I were calling a stock ticker service that allows you to supply a list of tickers as input so that you can get all your responses in one call. Anyone any thoughts on that?
    Cheers,
    Paul.

  • Where is OID departmentnumber value stored

    Hi All,
    In the DAS utility, or in Portal when editing your profile/credentials, there is a place for department. Where is this value stored in the ODS schema?
    For example, First name is stored in ct_givenname. Last Name is stored in ct_sn.. etc.
    Anyone know where department is stored? One would think there should be a ct_departmentnumber table.
    Any thoughts would be greatly appreciated.
    Rob

    Rob,
    departmentnumber is per default a non indexed (non cataloged) attribute thus you don't have a separate ct_departmentnumber table. You need to create a catalog for departmentnumber via catalog.sh.
    BTW: We discourage from accessing the DB schema and NEVER write into any OID DB table.
    regards,
    --Olaf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Having problem with storing data in array

    Hi,
    I'm having problem on storing data in array. My problem is that each time it loops, the array just keep overwrite instead save to the next index. Like at 0 the value is 123, and 1 is 234. But i having that all data capture all overwrite at 0 till the last data it still show at 0. How do i correct this problem?
    Solved!
    Go to Solution.

    How to use array to do comparison? Like Array 1 go thru array 2 to get data Loss out and build an array. Like Array 1 ,1000,1024,1048,etc before 1520 fall in between Array 2 range 1000-1500. So Freq 1000,1024,1048 etc will get Loss value as 1 and 1520 fall in between 1500-2000 will output Loss 2. and so on till the end of the list. How should do this? Need help on this.
    Array 1                                                Array 2
    Freq                                              ​     Freq   Loss
    1000                                              ​    1000      1
    1024                                              ​    1500      2
    1048                                              ​    2000      3
    1100                                              ​     :
    1200                                              ​     :
    :                                                 ​        18000
    1520
    18000

  • Java Reflection: Trying to access a constrcutor with an array argument.

    Having some reflection problem... upon reflection maybe I shouldn't use reflection... :-)
    The classes I use to test this are defined as follows:
    class MyTestClass{
      public long[] _array;
      public MyTestClass(long[] array)
        _array = array;
    class MyTestClass2{
      public int[] _array;
      public MyTestClass2(int[] array)
        _array = array;
    class MyTestClass3{
      public String[] _array;
      public MyTestClass3(String[] array)
        _array = array;
    class MyTestClass4{
      public Long[] _array;
      public MyTestClass(Long[] array)
        _array = array;
    }and this is how I try to access it:
      // Only classes that have a constrcutor with a single
      // param which is an array can be used with this method.
      // The class also has to define a public field called "_array"
      // which is of the ssame type as the parameter of the
      // constructor
      public Object getNewInstanceOf(String className)
        // getValues uses reflection to instanciate an array of objects of
        // certain types which are not known to start with, i.e getValues
        // can return Long[] or Integer[] or String[]
        Object[] values = getValues();
        Class myClass = Class.forName(className);
        myClass..getField("_array");
        Class paraClass = field.getType();
         Constructor constructor = myClass
                    .getConstructor(new Class[]{paraClass});
        // the problem occurs here, I think I would have to cast "values" to the
        // proper array type, but don't know how to do this using reflection.
        Object  myInstance = constructor.newInstance(new Object[]{values});
       return myInstance;
      private Object[] getValues()
        // use reflection to create the array
      }and this is the error I get
    java.lang.IllegalArgumentException: argument type mismatch

    we can be much helpfull if we do not know which line excatly throws exception
    normaly stack trace shows the line number so can you re-post your code highlitine the line which throws given exception

  • Any performance overhead if we get iterator over values stored in map

    Hi Everybody,
    Is there any performance overhead if we get iterator over values stored in map. like this
    Iterator itr = rolesMap.values().iterator();
    if yes please explain...thanks in advance.

    ejp wrote:
    That's rather out of date. It is how Hashtable works, but as regards HashMap it isn't. The keySet() iterator and the values() iterator are both written in terms of the entrySet() iterator. There is no skipping over unused slots.Out of date? In that case there's been a recent advance in hashed data structures I've missed.
    Or the HashMap implementation has been recently changed to internally link entries to improve iteration performance. I doubt that because such a list would degrade the performance of the HashMap in other ways and that's unacceptable (and unnecessary because of LinkedHashMap).
    Besides, what I said is in the Java 6 API documentation to LinkedHashMap. It may be out of date but I doubt it.
    So here we are with a fact of nature: Any iteration of a hash based data structure will be proportional to capacity rather than the number of entries, unless a supportive list style data structure is introduced to overcome this.

Maybe you are looking for