public  void sequenceStAnomalies(ArrayList<OutlierInfo> sTanomalies) {

        int loopSizeDeterminer;//determines teh size of the inner loop and is dynamic.

        for (int index = 0; index < sTanomalies.size(); index++) {
            OutlierInfo stOutlier = new OutlierInfo();
            stOutlier = sTanomalies.get(index);
            stAnomalies.add(index, stOutlier);
        }

        loopSizeDeterminer = stAnomalies.size();

        while (stAnomalies.size() != 0) 
        {
            OutlierInfo stOutlier1 = new OutlierInfo();
            ArrayList<OutlierInfo> tracker = new ArrayList();//arraylist that stores the grouped Outliers to be deleted later
            stOutlier1 = stAnomalies.get(firstElement);
            ArrayList<OutlierInfo> similarOutlierList = new ArrayList();//similaroutliers are kept in an arraylist
            similarOutlierList.add(stOutlier1);
            tracker.add(stOutlier1);

            for (int index = 1; index < loopSizeDeterminer; index++)
            {
                OutlierInfo similarStOutlier = new OutlierInfo();
                similarStOutlier = stAnomalies.get(index);

                //if(stOutlier1.serialId==stOutlier2.serialId)
                if (stOutlier1.id.equals(similarStOutlier.id)) 
                {
                    similarOutlierList.add(similarStOutlier);
                    tracker.add(similarStOutlier);
                }
            }

            sequencedStAnomalies.add(similarOutlierList);//adding arraylist of similar outliers to the arraylist of arraylist

            for (int index = 0; index < tracker.size(); index++)
            {
                OutlierInfo groupedOutlier = new OutlierInfo();
                groupedOutlier = tracker.get(index);
                stAnomalies.remove(groupedOutlier);//grouped outliers are removed from original arraylist containing spatio-temporal outliers to reduce redundancy
            }
          
            loopSizeDeterminer = stAnomalies.size();
        }
        
    }