Need Help in JAVA LIST .. Urgent //Thanks in advance :     class Solution {
    public List<List<Integer>> largeGroupPositions(String S) {
        //int k=0;
        List<Integer> l1 = new ArrayList<Integer>();
        List<List<Integer>> l2 = new ArrayList<List<Integer>>();
        int n = S.length();
        
        int count =1, i1=0, i2=0;
        for(int i=1; i<n; i++){
            if(S.charAt(i)==S.charAt(i-1)){
                count++;
                
            }else{
                i2 = i-1;
                if(count>=3){
                    l1.add(i1);
                    l1.add(i2);
                    l2.add(l1);
                  
                    
                }
                
                count =1;
                i1=i;
            }
        }
        
        return l2;
        
    }
}**I need this output [[3,5],[6,9],[12,14]], But i am getting [[3,5,6,9,12,14],[3,5,6,9,12,14],[3,5,6,9,12,14]], If i uses l1.clear() in else part then the changes is occuring in l2 also**