UtilMisc.java 679 B

1234567891011121314151617181920212223242526
  1. package com.zhcs.dt.controller.activiti.util;
  2. import java.util.HashMap;
  3. import java.util.Map;
  4. /**
  5. * 类名称:UtilMisc
  6. * 创建人:FH Admin fh313596790qq(青苔)
  7. * 更新时间:2018年1月31日
  8. * @version
  9. */
  10. public class UtilMisc {
  11. public static <V, V1 extends V, V2 extends V> Map<String, V> toMap(String name1, V1 value1, String name2, V2 value2) {
  12. return populateMap(new HashMap<String, V>(), name1, value1, name2, value2);
  13. }
  14. @SuppressWarnings("unchecked")
  15. private static <K, V> Map<String, V> populateMap(Map<String, V> map, Object... data) {
  16. for (int i = 0; i < data.length;) {
  17. map.put((String) data[i++], (V) data[i++]);
  18. }
  19. return map;
  20. }
  21. }