Wednesday, 20 June 2012

How to pass 3 list values to new list?

I have three list with same size with values in it, i want to pass these three list values to new list

VFP Page


{!list1}
{!list2}
{!list3}
{!list4}


Class

public with sharing class TEZ_AC_listString{
    
    List list1 ;
    List list2 ;
    List list3 ;
    List list4 ;
    public List getList1() {
        list1 = new List();
        list1.add(string.valueof(1));
        list1.add(string.valueof(2));
        list1.add(string.valueof(3));
        list1.add(string.valueof(4));
        list1.add(string.valueof(5));
        return list1 ;
    }
    public List getList2() {
        list2 = new List();
        list2.add(string.valueof(11));
        list2.add(string.valueof(12));
        list2.add(string.valueof(13));
        list2.add(string.valueof(14));
        list2.add(string.valueof(15));
        return list2 ;
    }
    public List getList3() {
        list3 = new List();
        list3.add(string.valueof(21));
        list3.add(string.valueof(22));
        list3.add(string.valueof(23));
        list3.add(string.valueof(24));
        list3.add(string.valueof(25));
        return list3 ;
    }
    
    public List getList4() {
        list4 = new List();
        for(Integer i=0; i < list1.size() ;i++){
            String str = list1.get(i)+','+list2.get(i)+','+list3.get(i);
            list4.add(str);
        }
        return list4 ;
    }
}


No comments:

Post a Comment