I have the following Set in Java:
Set< Set > SetTemp = new HashSet< Set >();
and I want to move its data to an ArrayList:
ArrayList< ArrayList< String > > List = new ArrayList< ArrayList< String > >);
Is it possible to do that ?
解决方案
You simply need to loop:
Set> setTemp = new HashSet> ();
List> list = new ArrayList> ();
for (Set subset : setTemp) {
list.add(new ArrayList (subset));
}
Note: you should start variable names in small caps to follow Java conventions.