码迷,mamicode.com
首页 > 编程语言 > 详细

java文字排序小记

时间:2019-07-20 11:36:25      阅读:96      评论:0      收藏:0      [点我收藏+]

标签:while   mamicode   src   iter   tcl   --   size   att   html   

List list = new ArrayList(); Document document = Jsoup.parse(new File("E:\\test\\erp_index.html"), "UTF-8"); final Elements bookname = document.getElementsByClass("bookname"); final Elements bookzz = document.getElementsByClass("bookzz"); final Elements bookjs = document.getElementsByClass("bookjs"); final Elements bookbtn = document.getElementsByClass("bookbtn"); for (int i = 0; i < bookname.size(); i++) { String s = bookname.get(i).select("a").attr("href"); LogUtil.info(bookname.get(i).text() + "," + bookzz.get(i).text() + "," + bookbtn.get(i).text()); list.add(new ClientVersion(bookbtn.get(i).text(), bookname.get(i).text()+"<-->"+s)); } LogUtil.info("一共多少:" + bookname.size()); Collections.sort(list, new Comparator<ClientVersion>() { @Override public int compare(ClientVersion o1, ClientVersion o2) { Comparator<Object> compare = Collator.getInstance(java.util.Locale.CHINA); return ((Collator) compare).compare(o1.getClient(), o2.getClient()); } }); final Iterator iterator = list.iterator(); while (iterator.hasNext()) { final ClientVersion next = (ClientVersion)iterator.next(); LogUtil.info(next.getClient() + "-->" + next.getClientVersion()); }

技术图片

java文字排序小记

标签:while   mamicode   src   iter   tcl   --   size   att   html   

原文地址:https://blog.51cto.com/357712148/2421897

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!