Get list inside, the number (string type) of the minimum length


static String Private getTransferRegisterContent (String txtValue) throws ActiveRecordException {
// the " pledge receivable transfer and registration of " start to the end, taken
String value = txtValue.substring (txtValue.indexOf ( " pledge receivable and transfer register ') + . 11) ;
the ArrayList <String> = the arrayList new new the ArrayList <> () ;
arrayList.add (value) ; // query the configuration table, the type of the registration board String SQL = "the SELECT" + "DICT_NAME" + "the FROM" + "sys_dict_entry" + "the WHERE" + "= DICT_TYPE_ID 'zd_register_type'" + "AND sys_status = 1";








List <the Record> zdRegisterList = Db. Find (SQL) ;
for (the Record zdRegister: zdRegisterList) {
// Get the type of the registration of each cycle
String = zdRegister.get Register ( "dictName") ; // taken the corresponding registered content type String = readPdf2Txt values. getTxtValueFromString (txtValue , " pledge receivable and the transfer of registration " , register) ; IF (the StringUtils. notBlank (values)) { arrayList.add (values) ; } } // Get arrayList minimum length of an object // definition of a map to stored data, taken the HashMap <Integer , String> hashMap '=









the HashMap new new <> () ;
for (String String: the arrayList) {
hashMap.put (String.length () , String) ;
}
// get all of the key values of
the Set <Integer> = hashMap.keySet SET () ;
Object [ ] set.toArray obj = () ;
// descending sort
Arrays,. Sort (obj) ;
// minimum value variable values
String resultValue = "" ;
// the key, find value
for (of Map.Entry <Integer , String> STR: TreeMap.entrySet ()) {
IF (obj [ 0] .equals (str.getKey ())) {
resultValue str.getValue = () ;
}
}
return resultValue;
}

Guess you like

Origin www.cnblogs.com/xiaowoniulx/p/11596212.html