function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Soumya sri yaravaSoumya sri yarava 

how can any one solve this issue for this please, of list contains method.

i have a duplicate list, and other list to check the duplicates.
code is correct, but need to check with the logic, can any one fix this issue please.
  //If i selected checkbox  A and B, i should get [false,true] //as A -letter is in the list.
//if selectd A, FALSE.
//if selectd B, TRUE.
public class test4 {

 public list<string>duplicatevalues{get;set;}
 public list<Wrapperclass>wraplist{get;set;}
 public list<boolean> Selectedbooleanlist{get;set;}
  public list<string>listSelectedNames{get;set;}
 public test4(){
 listSelectedNames = new list<string>();
  Selectedbooleanlist= new list<boolean>();
  duplicatevalues= new list<string>{'a','c'}; 
  wraplist = new list<Wrapperclass>();
        Wrapperclass   wf1 = new Wrapperclass();
                  wf1.selected=false;
                  wf1.name ='a';
                   wraplist.add(wf1);
        Wrapperclass   wf2 = new Wrapperclass();
                  wf2.selected=false;
                  wf2.name ='b';
               wraplist.add(wf2);
               
 }
   public void check(){
  Selectedbooleanlist.clear();
     for(wrapperclass wrap: wraplist){
      if(wrap.selected == true){
        listSelectedNames.add(wrap.name);
        //Selectedbooleanlist.add(wrap.selected);
        }  
      }
   
    for(String s1 : duplicatevalues){
    if(listSelectedNames.contains(s1)){
     boolean  sel = false;
     Selectedbooleanlist.add(sel);
     }
     }
   }
  
  public class Wrapperclass{
       public boolean selected{get;set;}
       public string Name{get;set;}
    }
}

Vfpage:
<apex:page controller="test4" >
     <apex:form >
   <apex:pageBlock >
      <apex:pageblockTable value="{!wraplist}"  var="a">
       <apex:column ><apex:inputCheckbox value="{!a.selected}"/>{!a.name}</apex:column>
       </apex:pageblockTable>
    <apex:commandButton value="OrderSelected"  reRender="one" action="{!check}"/>
       <apex:outputLabel id="one">{!Selectedbooleanlist}</apex:outputLabel>
    </apex:pageBlock>
   </apex:form>
     
</apex:page>

THANKS
SOUMYA SREE