字符串 独立字符串倒序

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class StringTest {

public static void main(String args[]){

StringTest st=new StringTest();
String str = "Consumption & hasConsumptionVendor value ?v & hasProduceWeek value ?w";
System.out.println(st.function(str));


}
  
public static List function(String str){

List list= new ArrayList();
String [] ary=str.split(" ");
for(int i=0;i<ary.length;i++){
list.add(ary[i]);
}

   Collections.reverse(list);
   return list;
}

}

你可能感兴趣的:(字符串)