I am new to Apex and cannot seem to find a solution to the error below on the last line of code. The error I get when compiling is "Method does not exist or incorrect signature: void get(Decimal) from the type List". Any help would be awesome. Thanks.
trigger LeadingCompetitor on Opportunity (before insert, before update) {
for (Opportunity opp : Trigger.new) {
List<Decimal> competitorPrices = new List<Decimal>();
competitorPrices.add(opp.Competitor_1_Price__c);
competitorPrices.add(opp.Competitor_2_Price__c);
competitorPrices.add(opp.Competitor_3_Price__c);
List<String> competitors = new List<String>();
competitors.add(opp.Competitor_1__c);
competitors.add(opp.Competitor_2__c);
competitors.add(opp.Competitor_3__c);
Decimal highestPrice;
Integer highestPricePosition;
for (Integer i = 0; i < competitorPrices.size(); i++) {
Decimal currentPrice = competitorPrices.get(i);
if (highestPrice == null || currentPrice > highestPrice) {
highestPrice = currentPrice;
highestPricePosition = i;
}
}
opp.Highest_Priced_Competitor__c = competitors.get(highestPricePosition);
opp.Highest_Price__c = competitorPrices.get(highestPrice);
}
}