|
@@ -1,48 +1,35 @@
|
|
package org.algorithm.test;
|
|
package org.algorithm.test;
|
|
|
|
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.Iterator;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
public class Test {
|
|
public class Test {
|
|
|
|
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
-
|
|
|
|
-// Integer aa = new Integer(53);
|
|
|
|
-// Integer bb = new Integer(954);
|
|
|
|
-// float xx = 1.0f;
|
|
|
|
-// for(int i=1; i< 955; i++) {
|
|
|
|
-// xx = (float)(Math.round(1.0f * i / bb*100000))/100000;
|
|
|
|
-// System.out.println(i+":"+xx);
|
|
|
|
-//// }
|
|
|
|
-// String filePath = "/opt/models/model_version_replacement/model";
|
|
|
|
-// int index = filePath.indexOf("model_version_replacement");
|
|
|
|
-//
|
|
|
|
-// System.out.println(filePath.substring(0, index));
|
|
|
|
-// public static void testJSONStrToJavaBeanObj(){
|
|
|
|
-//
|
|
|
|
-// Student student = JSON.parseObject(JSON_OBJ_STR, new TypeReference<Student>() {});
|
|
|
|
-// //Student student1 = JSONObject.parseObject(JSON_OBJ_STR, new TypeReference<Student>() {});//因为JSONObject继承了JSON,所以这样也是可以的
|
|
|
|
-//
|
|
|
|
-// System.out.println(student.getStudentName()+":"+student.getStudentAge());
|
|
|
|
-//
|
|
|
|
- String JSON_ARRAY_STR = "[{\"length\":4,\"offset\":0,\"property\":\"1\",\"text\":\"剑突下痛\",\"threshold\":0.0},{\"length\":2,\"offset\":4,\"property\":\"1\",\"text\":\"胀痛\",\"threshold\":0.0},{\"length\":2,\"offset\":6,\"property\":\"2\",\"text\":\"1天\",\"threshold\":0.0},{\"length\":1,\"offset\":8,\"text\":\",\",\"threshold\":0.0}]\n";
|
|
|
|
-// JSONArray jsonArray = JSONArray.parseArray(JSON_ARRAY_STR);
|
|
|
|
-//// String jsonString = "{\"length\":4,\"offset\":0,\"property\":\"1\",\"text\":\"剑突下痛\",\"threshold\":0.0}";
|
|
|
|
-//
|
|
|
|
-// for (int i = 0; i < jsonArray.size(); i++){
|
|
|
|
-// JSONObject job = jsonArray.getJSONObject(i);
|
|
|
|
-// LemmaInfo info = JSON.parseObject(job.toJSONString(), new TypeReference<LemmaInfo>() {});
|
|
|
|
-// //Student student1 = JSONObject.parseObject(JSON_OBJ_STR, new TypeReference<Student>() {});//因为JSONObject继承了JSON,所以这样也是可以的
|
|
|
|
-//
|
|
|
|
-// System.out.println(info.getLength()+":"+info.getText());
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
- int index = 0;
|
|
|
|
- for (int i=0; i<5; i++)
|
|
|
|
- for (int j = i+1; j< 6; j++){
|
|
|
|
- System.out.println(i + "," + j);
|
|
|
|
- index ++;
|
|
|
|
|
|
+
|
|
|
|
+ List<String> aList = new ArrayList<>();
|
|
|
|
+ aList.add("del");
|
|
|
|
+ aList.add("del");
|
|
|
|
+ aList.add("xx");
|
|
|
|
+ aList.add("yy");
|
|
|
|
+
|
|
|
|
+ Iterator<String> it = aList.iterator();
|
|
|
|
+ boolean xx = false;
|
|
|
|
+ while(it.hasNext()){
|
|
|
|
+ String x = it.next();
|
|
|
|
+ if (!xx){
|
|
|
|
+
|
|
|
|
+ if (x.equals("xx"))
|
|
|
|
+ xx = true;
|
|
|
|
+ }
|
|
|
|
+ if(xx){
|
|
|
|
+ it.remove();
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
|
|
- System.out.println(index);
|
|
|
|
|
|
+ System.out.println(aList);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|