Home > Back-end >  A List <Map <String, the String> wrong sequence
A List <Map <String, the String> wrong sequence

Time:10-13

I made a loop assignment, but the order is wrong, don't know where there are problems

Public static void main (String [] args)
{
List Bb=new ArrayList<> (a);
Map StringStringMap;

for(int i=1; i<=2; I++)
{
StringStringMap=new HashMap<> (a);

for(int j=1; j<=4; J++)
{
StringStringMap. Put (" u "+ I + j," w "+ I + j).
}
Bb. Add (stringStringMap);
}


System. The out. Println (bb);
}

Results:
[{u11=w11, u13=w13, u12=w12, u14=w14}, {u22=w22, u21=w21, u24=w24, u23=w23}]
  • Related