zoukankan      html  css  js  c++  java
  • 一个使用矢量的例子!

        public static void main(String[] arg) {
            //new CommonUtil().readFile("c:/content.txt");
            Connection conn = null;
            try {
                //System.out.println(URLEncoder.encode("E:\\fish\\P0001\\中文", "UTF-8"));
                //System.out.println(URLEncoder.encode("E:\\fish\\P0001\\test","GBK"));
                //System.out.println(URLDecoder.decode("E%3A%5Cfish%5CP0001_02_txl%5CCoding%5Cwebtxl%5Cmyfile%5C1147094473625%5C%C4%BF%C2%BC", "GBk"));
                //Vector v = FileInfo.getAllFiles("E:\\fish\\P0001_02_txl\\Coding\\webtxl\\myfile\\1147094473625");
                //for (int i=0;i<v.size();i++) {
                //System.out.println(v.get(i));
                //}
                //DataOutputStream os = null;
                //DataInputStream is = null;
                //ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(new File("c:/test.zip")));
                //zos.setComment("zip by test");
                //zos.setMethod(ZipOutputStream.DEFLATED);
                // for (int i=0;i<v.size();i++) {
                //String fileName = v.get(i).toString();
                //String fileName ="E:\\fish\\P0001_02_txl\\Coding\\webtxl\\myfile\\1147094473625";
                //zip(zos, fileName, "");
                // }
                //zos.close();
                //DecimalFormat df1 = new DecimalFormat("###0.00");
                //System.out.println(df1.format(1.333333));
                Class.forName("com.jnetdirect.jsql.JSQLDriver");
                conn = DriverManager.getConnection(
                    "jdbc:JSQLConnect://192.168.1.88:1433/canv", "sa", "canv");
                String sql = "select occupation,username from sync4j_user where occupation is not null and occupation <>'' order by occupation";
                DBUtil db = new DBUtil();
                ResultSet rs = (ResultSet) db.doSql(sql, db.QUERY_MODE, conn);
                List list = db.getListByRS(rs);
                int size = list.size();
                HashMap newlist = new HashMap();
                if (list != null && size > 0) {
                    HashMap h = (HashMap) list.get(0);
                    String temp = (String) h.get("occupation");
                    Vector newv = new Vector();
                    newlist.put(temp, newv);
                    for (int i = 0; i < size; i++) {
                        h = (HashMap) list.get(i);
                        String occ = (String) h.get("occupation");
                        if (temp.equals(occ)) {
                            newv.add( (String) h.get("username"));

                        } else {
                            temp = occ;
                            newv = new Vector();
                            newv.add( (String) h.get("username"));
                            newlist.put(temp, newv);
                        }
                    }
                }

              for (Iterator it = newlist.keySet().iterator();it.hasNext();) {
                  String key = (String)it.next();
                  Vector vt = (Vector)newlist.get(key);
                  System.out.println(key+" :");
                  for (int i=0;i<vt.size();i++) {
                      System.out.println(vt.get(i));
                  }
              }

            } catch (Exception ex) {
                ex.printStackTrace();

            }finally {
                try {
                    if (conn != null) {
                        conn.close();
                    }
                }catch (Exception e){}
            }

        }

  • 相关阅读:
    Airtest操作多台云手机,进行分发,多个脚本后端调度
    Airtest常见的元素定位不到
    pythonDES加密与解密以及hex输出和bs64格式输出
    adb命令将抓包工具证书从用户目录移动至系统目录,解决反爬对于本地证书认证
    解决appium每次app启动时候已登入账号会登出
    PHP数组循环遍历的几种方式
    TP5.1/TP框架的访问控制,访问不存在的模块、控制器、方法等控制
    PHP常用数组函数
    TP5截取部分字符串
    apache虚拟主机配置及解析
  • 原文地址:https://www.cnblogs.com/QDuck/p/413642.html
Copyright © 2011-2022 走看看