Help in adding values to particular vector in hasmap

Hi there,
I have a question. I need to create a hashmap< Object, vector<Integers>> so that each object has vector of Integers associated with it. But I need to add the Integers to this hashmap in such a way that each Integer gets added to the vector of its particular Integer. For example,
From list of object { 1d, 3d, 4c, 7c, 8c, 9c, 2f, 10g, 11a, and so on}
Object c will have integers 4,7, 8, Object d will have integers 1,3,9, Object a will have 11 and so on. I will need to add the Integers to its respective hasmap vector at runtime. That is I need to create
<c, <4,7,8>> and <d, <1,3,9>> and so on.
Is there any way of doing that?
Thanks a lot,
priyanka

Use ArrayList instead of Vector. Vector is a deprecated class, and ArrayList is it's recommended replacement.
To store an int with it's associated Object:
Get the List value associated with the key Object
    If the List is null
        There's no List mapped to that Object yet, so create new List, add int to it, and put the Object and new List in the map.
    If the List is not null
        Add the int to the List

Similar Messages

  • Please help with retrieving values from object stored in a vector

    hi..
    i have a class Magazine with 2 varibles name and price like this
    class magazine
    String name;
    int price;
    i have created a vector called selectedmag which stores objects of Magazine class... now each object will contain the name and price rite...
    i want to print the values stored in vector ie i want to print the vector elements...like
    Name: Mag1
    Price: 10
    which wil be present in object1...
    and then
    Name: Mag2
    Price:15
    which wil be present in object2...
    and so on...
    plz help...
    if i give selectedmag.elementAt(position) i am not able to get the above output...plz help me.....
    thanks,
    Akshatha

    hi,
    Yes i have used a for loop to print the values... it goes like this
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    class Magazine
         String title;
         int price;
    public class sessiontrack1 extends HttpServlet
         public void doPost(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
              res.setContentType("text/html");
              PrintWriter out=res.getWriter();
              HttpSession session=req.getSession(true);
    // This is my vector          
    Vector myshoppingcart=(Vector)session.getAttribute("ShoppingCart");
              if(myshoppingcart==null)
                   myshoppingcart=new Vector();
              Magazine selectedMag=new Magazine();
              selectedMag.title=req.getParameter("Title");
              selectedMag.price=Integer.parseInt(req.getParameter("Price"));
    //Putting Magazine object into the vector myshoppingcart
              myshoppingcart.addElement(selectedMag);
              session.setAttribute("ShoppingCart",myshoppingcart);
              out.println("<html><body>U have selected these magazines");
              out.println("<br>");
         //Enumeration vEnum=myshoppincart.elements();
    //here a am trying to print output the values
              for(int i=0;i<myshoppingcart.size();i++)
    out.println("Name:" + (Magazine)myshoppingcart.elementAt(i));
                   out.println("<br>");
    out.println("Price:" + (Magazine)myshoppingcart.elementAt(i));
                   out.println("<br>");
              out.println("</body></html>");
    this is a servlet program.... plz suggest me how to print the values... in the following format
    Name: Book1
    price: Rs 10
    Name:Book2
    price:Rs 15
    Akshatha

  • "Date Added" values changed to be identical in some folders

    Hi,
    I normally sort my work files (mostly .ppts) by "date added" to help me keep track, this usually works fine. I have the date added column showing in Finder and set the Folder Options to sort by date added.
    I noticed today that in some folders (but not all) the date added value has been re-set by the system to be a random date (eg 30 Jan 2015 15:28 for one folder), and the date and time added is the exact same for all the files. Obviously this means I can't sort them anymore. I was wondering why this has happened and if it can be fixed as it's a really annoying and potentially serious issue.
    Running Yosemite 10.10.2 on a mid-2012 MBP.
    Thanks

    Hi Subha,
    You can assing default values to the Variables...Fiscal Year2008; Version100...etc. so that the user need not input all the variables.
    I am not sure whether you can assign a function--"on selection" of variables.  For better control It would be prudent to advise users to execute a function (if need be embed a SAVE function with in the sequence) on press of a button.
    Regards
    Srinivas

  • Where could we find the CT and PT values  for Particular Device ???

    I 'm facing a scenario in  a report  i need to place a  field device number and assosiated  CT's and PT's .
    where could we find the CT and PT values  for Particular Device ??? basically im MM consultant   we don't ahave  DM consultant  please help with this issue???
    means actually i got the table and field  details  for transformation ratio (or) CT/PT ratio
                          ETYP_UEBERVER. from the screen EG03 , t-code
                            but im not sure   this  is the exact field that i require  ....
    can any one help ....   i will be very  thankfull to your  solution  inadvance....

    The transformation ratio are the attributes of a "Winding Group".  Find winding group of a device and then you'll get the desired information.

  • How to remove value from a vector (from its top index 0)

    HI Friends
    A basic question. In my code i am adding values in vector (v). Now i want to remove the values from the top of the vector (from index 0) and move them in an variable temp. How can i do it. I know there is a method remove in vector. but i am not sure how to use it.Can anybody show me how to do this?
    here is my peice of code
       public void result (){
            int temp1,temp2;
            for(int i=0; i<=  3000;i++){
               v.removeElement(i);
           }Thanks alot in advance

    Well, i'm Not sure what ur problem is...?!?
    Do U mean to say,
    You need to just remove the 0'th element from a Vector & store THAT in a element called temp..?!?
    Plz. have a look at the Vector class API in (for Java 1.4)
    http://java.sun.com/j2se/1.4.2/docs/api/
    There's a remove( ) which takes the index of the element to be removed...
    In ur case, u could say, for example
    Object temp = myVector.remove(0);or more appropriately,
    SomeType temp;
    temp = (SomeType)myVector.remove(0);--fritz                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • When Tcode and Object added to the particular role

    Dear Gurus,
    My question is that, how we can able to know that who (user ID) / when this tcode or object (with particular activities) has added to this particular roles/profiles.
    Regards,
    Sanjay

    Hi Sanjay,
    Goto SUIM->Change Documents->For Profile and select the profile of the role for which you would like to see the changes.
    After running the report, you will see the Objects added/removed. Click on each Object & it will show all the details, as in: who did, at what date, time, values entries etc
    Similarly, you can see the same for Roles also, if you want to see for Transaction codes

  • Unable to reduce previous year budget value for particular order

    Hi
    I am unable to reduce previous year budget value for particular order number in IM52 - process transactions - Returns
    The error msg is Overall budget less than cumulative budget
    Pls help to solve this issue.
    Regards
    P Karthikeyan

    Hi,
    Check the budget distrubuted to the internal orders values is matching with top node or parent node value or not, if that value is not matching with intenal order distrubution value then system will not accept to save.

  • Need help with NULL values in Crosstables

    Hello everybody,
    I need some help with NULL values and crosstables. My issue is the following:
    I have a query (BW - MDX-Query) that gives me turnover measures for each month. In Crystal Reports I choose crosstable to display this whereby I put all month in columns and all turnover-measures in rows. Each month that has a value (measures are not empty) is chown in the crosstables rows. So far so good. The problem occures when there are month that actually have no values (measures are empty). In that case these months are not chown in columns. But I need CR to display these columns and show the value 0. How can I do that?

    Hi Frank,
    Cross tab shows the data based on your column and these column fields are grouped and based on the group it will show your summaries. 
    If there is no data for any of your group it will not display that group.  In this case you will have to create a standard report which should look like cross tab and to get zero values you need to write formulas .
    Example if you want to display Moth wise sales :
    if Month() = 01 Then
    sum() else 0
    Now this formula will check if your month is Jan, then it will sum up the values else it will display zero value. 
    This is possible only through standard report not with Cross Tab.
    Thanks,
    Sastry

  • Highest stock value on particular date.

    Hi all,
    Where we can find the highest stock value for particular material for particular date .
    for the insurance purpose, we want to identify on which date highest stock value is lying with us.
    Thanks & Regards,
    Vinay Patel

    Hi Hareesha,
    You have given me transaction code for mean stock & mean value.This is not solution for my question
    total stock    total value          date
    100                   500             01.02.2007
      50                    300            02.02.2007
    200                  600             03.02.2007
    225                   580             04.02.2007
    so here 0n 03.02.2007 its showing highest value.
    Thanks & Regards,
    Vinay Patel

  • How to remove a value from a vector of vectors

    How can I remove a value from a vector inside another vector, say;
    Vector myvector= new Vector();
    Vector data= new Vector();
    myvector.addElement(rs.getString(1));
    myvector.addElement(rs.getString(2));
    myvector.addElement(rs.getString(3));
    data.addElement(myvector);
    I want to get an element in the Vector "myvector" at index 2.

    import java.util.*;
    public class Test {
      public static void main(String args[]) {
        Vector myvector= new Vector();
        Vector data= new Vector();
        myvector.addElement("Zero");
        myvector.addElement("One");
        myvector.addElement("Two");
        data.addElement(myvector);
        System.out.println("main vector initially contains:" + data);
        myvector.remove(1);
        System.out.println("main vector now contains:" + data);
    }Output:
    main vector initially contains:[[Zero, One, Two]]
    main vector now contains:[[Zero, Two]]
    Just to be sure I was correct in the first place. Perhaps you should have done likewise before continuing stick to your guns.

  • Help with adding image onclick

    Hey everyone,
    I am making a simple game in AS3 and need help with adding an image once they have click on something.
    On the left of the screen are sentences and on the right an image of a form. When they click each sentence on the left, writing appears on the form. Its very simple. With this said, what I would like to do is once the user click one of the sentences on the left, I would like a checkmark image to appear over the sentence so they know they have already clicked on it.
    How would I go about adding this to my code?
    var fields:Array = new Array();
    one_btn.addEventListener(MouseEvent.CLICK, onClick1a);
    one_btn.buttonMode = true;
    function onClick1a(event:MouseEvent):void
        fields.push(new one_form());
        fields[fields.length-1].x = 141;
        fields[fields.length-1].y = -85;
        this.addChild(fields[fields.length-1]);   
        one_btn.removeEventListener(MouseEvent.CLICK, onClick1a);
        one_btn.buttonMode = false;
        //gotoAndStop("one")
    two_btn.addEventListener(MouseEvent.CLICK, onClick2a);
    two_btn.buttonMode = true;
    function onClick2a(event:MouseEvent):void
        fields.push(new two_form());
        fields[fields.length-1].x = 343.25;
        fields[fields.length-1].y = -85;
        this.addChild(fields[fields.length-1]);
        two_btn.removeEventListener(MouseEvent.CLICK, onClick2a);
        two_btn.buttonMode = false;
        //gotoAndStop("two")

    I don't know where you're positioning the button that should enable/disable the checkbox but for "one_btn" let's just say it's at position: x=100, y=200. Say you'd want the checkbox to be to the left of it, so the checkbox would be displayed at: x=50, y=200. Also say you have a checkbox graphic in your library, exported for actionscript with the name "CheckBoxGraphic".
    Using your code with some sprinkles:
    // I'd turn this into a sprite but we'll use the default, MovieClip
    var _checkBox:MovieClip = new CheckBoxGraphic();
    // add to display list but hide
    _checkBox.visible = false;
    // just for optimization
    _checkBox.mouseEnabled = false;
    _checkBox.cacheAsBitmap = true;
    // adding it early so make sure the forms loaded don't overlap the
    // checkbox or it will cover it, otherwise swapping of depths is needed
    addChild(_checkBox);
    // I'll use a flag (a reference for this) to know what button is currently pushed
    var _currentButton:Object;
    one_btn.addEventListener(MouseEvent.CLICK, onClick1a);
    one_btn.buttonMode = true;
    function onClick1a(event:MouseEvent):void
         // Check if this button is currently the pressed button
         if (_currentButton == one_btn)
              // disable checkbox, remove form
              _checkBox.visible = false;
              // form should be last added to fields array, remove
              removeChild(fields[fields.length - 1]);
              fields.pop();
              // clear any reference to this button
              _currentButton = null;
         else
              // enable checkbox
              _checkBox.visible = true;
              _checkBox.x = 50;
              _checkBox.y = 200;
              // add form
              fields.push(new one_form());
              fields[fields.length-1].x = 141;
              fields[fields.length-1].y = -85;
              this.addChild(fields[fields.length-1]);
              // save this button as last clicked
              _currentButton = one_btn;
         // not sure what this is
        //gotoAndStop("one")
    I'd also centralize all the click handlers into a single handler and use the buttons name to branch on what to do, but that's a different discussion. Just see if this makes sense to you.
    The jist is a graphic of a checkbox that is a MovieClip symbol in your library exported to actionscript with the class name CheckBoxGraphic() is created and added to the display list.
    I made a variable that points itself to the last clicked button, when the "on" state is desired. If I detect the last clicked button was this button, I remove the form I added and the checkbox. If the last clicked button is not this button, I enable and position the checkbox as well as add the form.
    What is left to do is handle the sitation where multiple buttons are on the screen. When a new button is pushed it should remove anything the previous button added. This code simply demonstrates clicking the same button multiple times to toggle it "on and off".

  • In Supplier View SNC Packaging Materials F4 help has no values

    Dear Friends,
    While creating ASN and subsequent HU: In Supplier View SNC Packaging Materials F4 help has no values. Although this material/ product exists in customer location.
    Thanks and Best Regards, Manoj

    Hi Manoj,
    Click below link this may help you
    http://help.sap.com/saphelp_snc70/helpdata/EN/46/7542dd6d8c69dfe10000000a11466f/frameset.htm
    In our system i am able get packaging material when i press F4 after maintaing data in packaging tab.
    When i create ASN then click on package button then click on Create HU and then go to Packaging material field and press F4 i am able to view packaging material data.
    I am sure you have assign this material location to model 000 but just check.
    Let me know if your issue is resolved.
    Thanks,
    Nikhil

  • How to read the 'Input help with fixed values' of domain .

    How to read the 'Input help with fixed values' of domain .
    The domain has a Value range i want to read those values .
    Are these values stored in any table ?
    Plz help me i need it ver badly...
    Thanks in Advance...

    Hi Chandra Shekhar,
    To read the 'Input help with fixed values' of domain , you can use the function module : HR_P_GET_FIXED_VALUE_TEXT.
    iIf you enter the domain name, you will find the fixed values entered in the domain.
    These values are stored in a table DD07L(DD zero 7 L). Here the values are stored based on domain name.
    See if it works for you.
    Award points if its helpful.
    Regards,
    Bhanu

  • Remove row from table when adding values to another table

    hi am adding value programticaly how can i remove the row i just  add from the table
    this is how am adding value
    public void addMember(javax.faces.event.ActionEvent actionEvent) {
    List<String> tempTable = new ArrayList<String>();
    //Code to get the bindings for TargetVO :
    RowKeySet selectedEmps = getEmpTable().getSelectedRowKeys(); 
    Iterator selectedEmpIter = selectedEmps.iterator();
    DCBindingContainer bindings =
    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding empIter = bindings.findIteratorBinding("UserDetailsViewVO1Iterator");
    RowSetIterator empRSIter = empIter.getRowSetIterator();
    while(selectedEmpIter.hasNext()){
    Key key = (Key)((List)selectedEmpIter.next()).get(0);
    Row currentRow = empRSIter.getRow(key);
    onRowCreate(currentRow);
    boolean b = selectedEmps.remove(currentRow);
            i what to clear the row i just selected from the table
    AdfFacesContext.getCurrentInstance().addPartialTarget(empTable);
    // empTable
    public void onRowCreate( Row currentRow ) {
    BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
    //access the name of the iterator the table is bound to.
    DCIteratorBinding dciter = (DCIteratorBinding) bindings.get("addmemberBeanIterator");
    //access the underlying RowSetIterator
    RowSetIterator rsi = dciter.getRowSetIterator();
    //get handle to the last row
    Row lastRow = rsi.last();
    //obtain the index of the last row
    int lastRowIndex = rsi.getRangeIndexOf(lastRow);
    /*check if the user is added already*/
    /*OperationBinding oper2 = (OperationBinding) bindings.get("check if user exists method binding");
    oper2.getParamsMap().put("attributeName1", uniqueUserAttributeValue);
    Object ret = oper2.execute();*/
    //create a new row
    Row newRow = rsi.createRow();
    String f = (String)currentRow.getAttribute("Firstname");
    String s = (String)currentRow.getAttribute("Surname");
    String u = (String)currentRow.getAttribute("Username");
    String n = (String)currentRow.getAttribute("Emailaddress");
    // String orgid = (String)currentRow.getAttribute("Organisationid");
    newRow.setAttribute("firstname", f);
    newRow.setAttribute("surname", s);
    newRow.setAttribute("name", u);
    newRow.setAttribute("emailaddress", n);
    // newRow.setAttribute("Organisationid1",orgid);
    //initialize the row
    newRow.setNewRowState(Row.STATUS_INITIALIZED);
    //add row to last index + 1 so it becomes last in the range set
    rsi.insertRowAtRangeIndex(lastRowIndex +1,  newRow);
    //make row the current row so it is displayed correctly
    rsi.setCurrentRow(newRow); 
    System.out.println("Username " + u);
    System.out.println("firstname " + f);
    System.out.println("surname " + s);
    System.out.println("email " + n);
    // refereshpage();
    // return null;
    am in jdevloper 11.1.1.6.0
    my table is
    public void onRowCreate( Row currentRow ) {
    BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
    //access the name of the iterator the table is bound to.
    DCIteratorBinding dciter = (DCIteratorBinding) bindings.get("addmemberBeanIterator");
    //access the underlying RowSetIterator
    RowSetIterator rsi = dciter.getRowSetIterator();
    //get handle to the last row
    Row lastRow = rsi.last();
    //obtain the index of the last row
    int lastRowIndex = rsi.getRangeIndexOf(lastRow);
    /*check if the user is added already*/
    /*OperationBinding oper2 = (OperationBinding) bindings.get("check if user exists method binding");
    oper2.getParamsMap().put("attributeName1", uniqueUserAttributeValue);
    Object ret = oper2.execute();*/
    //create a new row
    Row newRow = rsi.createRow();
    String f = (String)currentRow.getAttribute("Firstname");
    String s = (String)currentRow.getAttribute("Surname");
    String u = (String)currentRow.getAttribute("Username");
    String n = (String)currentRow.getAttribute("Emailaddress");
    // String orgid = (String)currentRow.getAttribute("Organisationid");
    newRow.setAttribute("firstname", f);
    newRow.setAttribute("surname", s);
    newRow.setAttribute("name", u);
    newRow.setAttribute("emailaddress", n);
    // newRow.setAttribute("Organisationid1",orgid);
    //initialize the row
    newRow.setNewRowState(Row.STATUS_INITIALIZED);
    //add row to last index + 1 so it becomes last in the range set
    rsi.insertRowAtRangeIndex(lastRowIndex +1,  newRow);
    //make row the current row so it is displayed correctly
    rsi.setCurrentRow(newRow);  
    System.out.println("Username " + u);
    System.out.println("firstname " + f);
    System.out.println("surname " + s);
    System.out.println("email " + n);
    // refereshpage();
    // return null;

    hi,
    make the table selection single and use this links 4 ur task.
    http://www.baigzeeshan.com/2010/06/deleting-multi-selected-rows-from-adf.html
    http://deepakcs.blogspot.com/2013/01/ejb-dc-deleting-multi-selected-rows.html
    https://forums.oracle.com/thread/2534813
    https://blogs.oracle.com/jdevotnharvest/entry/iterating_selected_rows_in_an
    txs

  • Need urgent help in adding border to a Box

    Hi folks,
    i need help in adding a border to the box which i am using in my java code.
    i have somthing like.. I am not using BorderLayout as my layout Manager. Its all Flow Layout.
    Box name;
    Box rules;
    Box combine;
    name = Box.createVerticalBox();
    // i need to add a border to this name box which i am unable to do. Please help
    rules = Box.createVerticalBox();
    // again here too i want to add a border like etched border. Cant do it
    name.add(....);
    name.add(...);
    rules.add(...);
    rules.add(..);
    combine = Box.createVerticalBox();
    //here too i want to add a border
    Please help...
    thking u.
    regds. divya

    You can use setBorder() method which Box inherits from JComponent...
    check the API for Box for further information, namely the "Methods inherited from class javax.swing.JComponent" part...
    - MaxxDmg...
    - ' He who never sleeps... '

Maybe you are looking for

  • Outline Agreement archived before the corresponding purchase order was closed

    Hi All, I would like to know that whether an outline agreement can be archived before all the purchase orders corresponding to it are closed? We have some open POs and the contract corresponding to that has been already archived. Please suggest, Than

  • Attaching layers to edges of other layers

    Here's a mockup of I'd like to do: (click to see animated GIF) The smaller square layer is "attached" to a corner of the larger solid. As the larger solid moves, the square maintains its relative position. It also rotates along with it.  However, whe

  • CD rom is down...

    I am having a "Unable to find driver for this platform: PowerMAC3.5" message and I need to use the CD rom to install and it does not work. Any takers? Please, please!

  • Itunes 10 64bits can't recognize iphone

    my laptop OS is Win7 Home edition 64bits version, and I installed itunes 10 64bits on my laptop, but it can not recognize my iphone. it works ok on my other Vista 32bits laptop.

  • Selection screen option for Screen type like inDEMO_SEL_SCREEN_AS_SUBSCREEN

    hello, in this program there are 2 selection screens,called from MAIN screen. DEMO_SEL_SCREEN_AS_SUBSCREEN i want to create similar.. In main screen i will have 3  screens (which should have of screen type 'Selection screen ' ) and 1 BOX (in which I