1
votes

I'm pretty new in salesforce and here is my question : I created a List of class instance :

  for(string val : Spct.Sales_Methodologies_and_Tools__c.split(';')){
            if (!salesMethodologies.contains(val)){
                MethodologiesTypeList.add(new SalesPortal_Utils.CustomThumbnail(val, attachmentID, ''));
                MethodologiesMap.put(val, new list<SalesPortal_Content__c>());
                salesMethodologies.add(val) ;
            }
        }

as you can see i also created a map ( but it's not impotant for now)

now I want to pass over my list of class instances and if with my key the value of my map is empty I want to delete my instance from the List

 for (SalesPortal_Utils.CustomThumbnail delfromList : MethodologiesTypeList){
        string value = delfromList.title;
        if (isEmpty(MethodologiesMap.get(value))){
            MethodologiesTypeList.remove(delfromList);
        }
    }

i got this error message :

Description Resource Path Location Type Save error: Method does not exist or incorrect signature: [LIST].remove(SalesPortal_Utils.CustomThumbnail) Ctrl_SalesPortal_Homepage.cls /Click/src/classes line 61 Force.com save problem

1

1 Answers

1
votes

Remove should get an integer index. Dont forget to adjust your index after removing an object to not skip object from list.