inncorrect signature: void put(OpportunityLineItem) from the type Map [closed]












1















I have this below code which is throwing error. Can anyone help what is going wrong.



Error




Method does not exist or incorrect signature: void put(OpportunityLineItem) from the type Map




Code



Map<Id,OpportunityLineItem> mapOli = new Map<Id,OpportunityLineItem> ();
for(OpportunityLineItemSchedule sch: lstLineItemSchedule) {
If(mapOli.get(sch.OpportunityLineItemId) == null) {
Decimal oliUniPrice = oliIDToSalesPriceMap.get(sch.OpportunityLineItemId);
mapOli.put(new OpportunityLineItem(Id=sch.Id,UnitPrice =oliUniPrice));
}
}









share|improve this question















closed as off-topic by Pranay Jaiswal, glls, Mohith Shrivastava, Raul, Christian Deckert Dec 21 '18 at 7:56


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions on problems in code you've written must describe the specific problem and include valid code to reproduce it. For help writing short, self-contained syntactically-valid examples, see: SSCCE.org" – glls, Mohith Shrivastava, Raul, Christian Deckert

If this question can be reworded to fit the rules in the help center, please edit the question.





















    1















    I have this below code which is throwing error. Can anyone help what is going wrong.



    Error




    Method does not exist or incorrect signature: void put(OpportunityLineItem) from the type Map




    Code



    Map<Id,OpportunityLineItem> mapOli = new Map<Id,OpportunityLineItem> ();
    for(OpportunityLineItemSchedule sch: lstLineItemSchedule) {
    If(mapOli.get(sch.OpportunityLineItemId) == null) {
    Decimal oliUniPrice = oliIDToSalesPriceMap.get(sch.OpportunityLineItemId);
    mapOli.put(new OpportunityLineItem(Id=sch.Id,UnitPrice =oliUniPrice));
    }
    }









    share|improve this question















    closed as off-topic by Pranay Jaiswal, glls, Mohith Shrivastava, Raul, Christian Deckert Dec 21 '18 at 7:56


    This question appears to be off-topic. The users who voted to close gave this specific reason:


    • "Questions on problems in code you've written must describe the specific problem and include valid code to reproduce it. For help writing short, self-contained syntactically-valid examples, see: SSCCE.org" – glls, Mohith Shrivastava, Raul, Christian Deckert

    If this question can be reworded to fit the rules in the help center, please edit the question.



















      1












      1








      1








      I have this below code which is throwing error. Can anyone help what is going wrong.



      Error




      Method does not exist or incorrect signature: void put(OpportunityLineItem) from the type Map




      Code



      Map<Id,OpportunityLineItem> mapOli = new Map<Id,OpportunityLineItem> ();
      for(OpportunityLineItemSchedule sch: lstLineItemSchedule) {
      If(mapOli.get(sch.OpportunityLineItemId) == null) {
      Decimal oliUniPrice = oliIDToSalesPriceMap.get(sch.OpportunityLineItemId);
      mapOli.put(new OpportunityLineItem(Id=sch.Id,UnitPrice =oliUniPrice));
      }
      }









      share|improve this question
















      I have this below code which is throwing error. Can anyone help what is going wrong.



      Error




      Method does not exist or incorrect signature: void put(OpportunityLineItem) from the type Map




      Code



      Map<Id,OpportunityLineItem> mapOli = new Map<Id,OpportunityLineItem> ();
      for(OpportunityLineItemSchedule sch: lstLineItemSchedule) {
      If(mapOli.get(sch.OpportunityLineItemId) == null) {
      Decimal oliUniPrice = oliIDToSalesPriceMap.get(sch.OpportunityLineItemId);
      mapOli.put(new OpportunityLineItem(Id=sch.Id,UnitPrice =oliUniPrice));
      }
      }






      apex map






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 14 '18 at 18:07









      Jayant Das

      16k2826




      16k2826










      asked Dec 14 '18 at 15:37









      learningmodelearningmode

      317




      317




      closed as off-topic by Pranay Jaiswal, glls, Mohith Shrivastava, Raul, Christian Deckert Dec 21 '18 at 7:56


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "Questions on problems in code you've written must describe the specific problem and include valid code to reproduce it. For help writing short, self-contained syntactically-valid examples, see: SSCCE.org" – glls, Mohith Shrivastava, Raul, Christian Deckert

      If this question can be reworded to fit the rules in the help center, please edit the question.







      closed as off-topic by Pranay Jaiswal, glls, Mohith Shrivastava, Raul, Christian Deckert Dec 21 '18 at 7:56


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "Questions on problems in code you've written must describe the specific problem and include valid code to reproduce it. For help writing short, self-contained syntactically-valid examples, see: SSCCE.org" – glls, Mohith Shrivastava, Raul, Christian Deckert

      If this question can be reworded to fit the rules in the help center, please edit the question.






















          1 Answer
          1






          active

          oldest

          votes


















          7














          A Map.put() expects a <key, value> pair whenever you add an element in it. The signature for the method is: public Object put(Object key, Object value).



          In your case, you are missing the key to be added in the Map and thus the error.



          mapOli.put(new OpportunityLineItem(Id=oLisch.Id,UnitPrice =oliUniPrice));


          You will need to change this to as below:



          mapOli.put(<key- whatever you choose>, new OpportunityLineItem(Id=oLisch.Id,UnitPrice =oliUniPrice));





          share|improve this answer






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            7














            A Map.put() expects a <key, value> pair whenever you add an element in it. The signature for the method is: public Object put(Object key, Object value).



            In your case, you are missing the key to be added in the Map and thus the error.



            mapOli.put(new OpportunityLineItem(Id=oLisch.Id,UnitPrice =oliUniPrice));


            You will need to change this to as below:



            mapOli.put(<key- whatever you choose>, new OpportunityLineItem(Id=oLisch.Id,UnitPrice =oliUniPrice));





            share|improve this answer




























              7














              A Map.put() expects a <key, value> pair whenever you add an element in it. The signature for the method is: public Object put(Object key, Object value).



              In your case, you are missing the key to be added in the Map and thus the error.



              mapOli.put(new OpportunityLineItem(Id=oLisch.Id,UnitPrice =oliUniPrice));


              You will need to change this to as below:



              mapOli.put(<key- whatever you choose>, new OpportunityLineItem(Id=oLisch.Id,UnitPrice =oliUniPrice));





              share|improve this answer


























                7












                7








                7







                A Map.put() expects a <key, value> pair whenever you add an element in it. The signature for the method is: public Object put(Object key, Object value).



                In your case, you are missing the key to be added in the Map and thus the error.



                mapOli.put(new OpportunityLineItem(Id=oLisch.Id,UnitPrice =oliUniPrice));


                You will need to change this to as below:



                mapOli.put(<key- whatever you choose>, new OpportunityLineItem(Id=oLisch.Id,UnitPrice =oliUniPrice));





                share|improve this answer













                A Map.put() expects a <key, value> pair whenever you add an element in it. The signature for the method is: public Object put(Object key, Object value).



                In your case, you are missing the key to be added in the Map and thus the error.



                mapOli.put(new OpportunityLineItem(Id=oLisch.Id,UnitPrice =oliUniPrice));


                You will need to change this to as below:



                mapOli.put(<key- whatever you choose>, new OpportunityLineItem(Id=oLisch.Id,UnitPrice =oliUniPrice));






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 14 '18 at 15:40









                Jayant DasJayant Das

                16k2826




                16k2826















                    Popular posts from this blog

                    Le Mesnil-Réaume

                    Ida-Boy-Ed-Garten

                    web3.py web3.isConnected() returns false always