inncorrect signature: void put(OpportunityLineItem) from the type Map [closed]
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
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.
add a comment |
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
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.
add a comment |
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
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
apex map
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.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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));
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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));
add a comment |
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));
add a comment |
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));
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));
answered Dec 14 '18 at 15:40
Jayant DasJayant Das
16k2826
16k2826
add a comment |
add a comment |