java - Hi Im splitting a list into two and adding it to the main list...so How do i add the left out list data -


hi i'm splitting list m getting two...and adding main list , i'm returning main list....now if have 10 products me..i specifications 10 products , adding 7 main list....now, how can add remaining 3 products specs main list

i have tried

public static list<list> getspecdata(map<string, string> specifications) {     int count=0;     list mainlist = new arraylist<list>();     list l = new arraylist<string>();     for(string s : specifications.keyset())     {          l.add(specifications.get(s));         if(count==7)         {             mainlist.add(l);             l = new arraylist<string>();             count=0;         }         count++;     }     return mainlist; } 

try adding if condition if (count> 7), did count ==7.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -