Import java.util.treemap;
Public class d
Public static void main(String[] args) {
ArrayList & lt string & gtlist = new ArrayList & lt string & gt ();
list . add(" a 1 b 1 c 1 ");
list . add(" a2 B2 C2 ");
Tree diagram & ltString, String & gt treemap = new treemap & lt string, string & gt ();
for(int I = 0; I< list. size (); i++){
treemap.put(list.get(i))。 split(" "[0],list . get(I));
}
}
}
//Put the string into the list in the Map, where a is the key.
//It's easier to put it in the list
ArrayList & lt string & gtnewList = new ArrayList & lt string & gt ();
new list . addall(treemap . values());