Commit cb8e9f42 authored by Quxl's avatar Quxl

x

parent f0dabfa2
...@@ -10,6 +10,7 @@ import java.util.Collection; ...@@ -10,6 +10,7 @@ import java.util.Collection;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
...@@ -56,7 +57,7 @@ public class Util { ...@@ -56,7 +57,7 @@ public class Util {
tmp.put(keys[i], value); tmp.put(keys[i], value);
} else { } else {
if(tmp.get(keys[i]) == null) { if(tmp.get(keys[i]) == null) {
tmp.put(keys[i], new HashMap<Object, Object>()); tmp.put(keys[i], new LinkedHashMap<Object, Object>());
} }
tmp = (Map<Object, Object>)tmp.get(keys[i]); tmp = (Map<Object, Object>)tmp.get(keys[i]);
} }
...@@ -237,7 +238,7 @@ public class Util { ...@@ -237,7 +238,7 @@ public class Util {
if(obj == null) { if(obj == null) {
return null; return null;
} }
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new LinkedHashMap<String, Object>();
if(obj instanceof Map) { if(obj instanceof Map) {
Map<?, ?> objMap = (Map<?, ?>)obj; Map<?, ?> objMap = (Map<?, ?>)obj;
for(Object key : objMap.keySet()) { for(Object key : objMap.keySet()) {
...@@ -275,7 +276,7 @@ public class Util { ...@@ -275,7 +276,7 @@ public class Util {
} }
public static Map<String, String> ToMap(Map<String, String[]> parameterMap) { public static Map<String, String> ToMap(Map<String, String[]> parameterMap) {
Map<String, String> resultMap = new HashMap<String, String>(); Map<String, String> resultMap = new LinkedHashMap<String, String>();
for(String key : parameterMap.keySet()) { for(String key : parameterMap.keySet()) {
String[] valueArray = parameterMap.get(key); String[] valueArray = parameterMap.get(key);
resultMap.put(String.valueOf(key), valueArray.length > 0 ? valueArray[0] : null); resultMap.put(String.valueOf(key), valueArray.length > 0 ? valueArray[0] : null);
...@@ -292,7 +293,7 @@ public class Util { ...@@ -292,7 +293,7 @@ public class Util {
} }
public static <T> Map<String, T> objsToMM(List<T> objs, String bar, String... keyNames) { public static <T> Map<String, T> objsToMM(List<T> objs, String bar, String... keyNames) {
Map<String, T> maps = new HashMap<String, T>(); Map<String, T> maps = new LinkedHashMap<String, T>();
if(objs != null) { if(objs != null) {
for(T obj : objs) { for(T obj : objs) {
List<String> keyValues = new ArrayList<String>(); List<String> keyValues = new ArrayList<String>();
...@@ -309,7 +310,7 @@ public class Util { ...@@ -309,7 +310,7 @@ public class Util {
} }
public static Map<String, Map<String, Object>> listToMM(List<Map<String, Object>> datas, String bar, String... keyNames) { public static Map<String, Map<String, Object>> listToMM(List<Map<String, Object>> datas, String bar, String... keyNames) {
Map<String, Map<String, Object>> maps = new HashMap<String, Map<String, Object>>(); Map<String, Map<String, Object>> maps = new LinkedHashMap<String, Map<String, Object>>();
if(datas != null) { if(datas != null) {
for(Map<String, Object> map : datas) { for(Map<String, Object> map : datas) {
if(map.size() > 0) { if(map.size() > 0) {
...@@ -334,7 +335,7 @@ public class Util { ...@@ -334,7 +335,7 @@ public class Util {
} }
public static Map<String, List<Map<String, Object>>> listToML(List<Map<String, Object>> datas, String keyName) { public static Map<String, List<Map<String, Object>>> listToML(List<Map<String, Object>> datas, String keyName) {
Map<String, List<Map<String, Object>>> mapDatas = new HashMap<String, List<Map<String, Object>>>(); Map<String, List<Map<String, Object>>> mapDatas = new LinkedHashMap<String, List<Map<String, Object>>>();
if(datas != null) { if(datas != null) {
for(Map<String, Object> map : datas) { for(Map<String, Object> map : datas) {
if(map.size() > 0) { if(map.size() > 0) {
...@@ -352,7 +353,7 @@ public class Util { ...@@ -352,7 +353,7 @@ public class Util {
} }
public static Map<String, List<Map<String, Object>>> listToML(List<Map<String, Object>> datas, String bar, String... keyName) { public static Map<String, List<Map<String, Object>>> listToML(List<Map<String, Object>> datas, String bar, String... keyName) {
Map<String, List<Map<String, Object>>> mapDatas = new HashMap<String, List<Map<String, Object>>>(); Map<String, List<Map<String, Object>>> mapDatas = new LinkedHashMap<String, List<Map<String, Object>>>();
if(datas != null) { if(datas != null) {
for(Map<String, Object> map : datas) { for(Map<String, Object> map : datas) {
if(map.size() > 0) { if(map.size() > 0) {
...@@ -462,7 +463,7 @@ public class Util { ...@@ -462,7 +463,7 @@ public class Util {
* @throws * @throws
*/ */
public static Map<?, ?> reMap(Map<?, ?> fromMap) { public static Map<?, ?> reMap(Map<?, ?> fromMap) {
Map<Object, Object> map = new HashMap<Object, Object>(); Map<Object, Object> map = new LinkedHashMap<Object, Object>();
for(Object key : fromMap.keySet()) { for(Object key : fromMap.keySet()) {
Object obj = fromMap.get(key); Object obj = fromMap.get(key);
if(obj instanceof Map) { if(obj instanceof Map) {
...@@ -484,7 +485,7 @@ public class Util { ...@@ -484,7 +485,7 @@ public class Util {
* @return * @return
*/ */
public static <T> T converArgs(Class<T> type, Map<?, ?> args, String name) { public static <T> T converArgs(Class<T> type, Map<?, ?> args, String name) {
Map<String, String[]> map = new HashMap<String, String[]>(); Map<String, String[]> map = new LinkedHashMap<String, String[]>();
for(Object arg_key : args.keySet()) { for(Object arg_key : args.keySet()) {
String key = String.valueOf(arg_key); String key = String.valueOf(arg_key);
if(key.startsWith(name + ".")) { if(key.startsWith(name + ".")) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment