JAVA 集合 List 分组的两种方法
<h1>
<span class="link_title"><a href="/yangxiaojun9238/article/details/51500934">
JAVA 集合 List 分组的两种方法
</a></span>
</h1>
<div class="article_manage clearfix">
<div class="article_r">
<span class="link_postdate">2016-05-25 19:25</span>
<span class="link_view" title="阅读次数">2243人阅读</span>
<span class="link_comments" title="评论次数"> <a href="#comments" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_pinglun'])">评论</a>(0)</span>
<span class="link_collect tracking-ad" data-mod="popu_171"> <a href="javascript:void(0);" onclick="javascript:collectArticle('JAVA+%e9%9b%86%e5%90%88+List+%e5%88%86%e7%bb%84%e7%9a%84%e4%b8%a4%e7%a7%8d%e6%96%b9%e6%b3%95','51500934');return false;" title="收藏" target="_blank">收藏</a></span>
<span class="link_report"> <a href="#report" onclick="javascript:report(51500934,2);return false;" title="举报">举报</a></span>
</div>
</div>
<div class="embody" style="display:none" id="embody">
<span class="embody_t">本文章已收录于:</span>
<div class="embody_c" id="lib" value="{"err":0,"msg":"ok","data":[]}"></div>
</div>
<style type="text/css">
.embody{
padding:10px 10px 10px;
margin:0 -20px;
border-bottom:solid 1px #ededed;
}
.embody_b{
margin:0 ;
padding:10px 0;
}
.embody .embody_t,.embody .embody_c{
display: inline-block;
margin-right:10px;
}
.embody_t{
font-size: 12px;
color:#999;
}
.embody_c{
font-size: 12px;
}
.embody_c img,.embody_c em{
display: inline-block;
vertical-align: middle;
}
.embody_c img{
width:30px;
height:30px;
}
.embody_c em{
margin: 0 20px 0 10px;
color:#333;
font-style: normal;
}
</style>
<script type="text/javascript">
$(function () {
try
{
var lib = eval("("+$("#lib").attr("value")+")");
var html = "";
if (lib.err == 0) {
$.each(lib.data, function (i) {
var obj = lib.data[i];
//html += '<img src="' + obj.logo + '"/>' + obj.name + " ";
html += ' <a href="' + obj.url + '" target="_blank">';
html += ' <img src="' + obj.logo + '">';
html += ' <em><b>' + obj.name + '</b></em>';
html += ' </a>';
});
if (html != "") {
setTimeout(function () {
$("#lib").html(html);
$("#embody").show();
}, 100);
}
}
} catch (err)
{ }
});
</script>
<div class="category clearfix">
<div class="category_l">
<img src="http://static.blog.csdn.net/images/category_icon.jpg">
<span>分类:</span>
</div>
<div class="category_r">
<label onclick="GetCategoryArticles('1088196','yangxiaojun9238','top','51500934');">
<span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_fenlei']);">JAVASE学习笔记<em>(22)</em></span>
<img class="arrow-down" src="http://static.blog.csdn.net/images/arrow_triangle _down.jpg" style="display:inline;">
<img class="arrow-up" src="http://static.blog.csdn.net/images/arrow_triangle_up.jpg" style="display:none;">
<div class="subItem">
<div class="subItem_t"><a href="http://blog.csdn.net/yangxiaojun9238/article/category/1088196" target="_blank">作者同类文章</a><i class="J_close">X</i></div>
<ul class="subItem_l" id="top_1088196">
</ul>
</div>
</label>
</div>
</div>
<script type="text/javascript" src="http://static.blog.csdn.net/scripts/category.js"></script>
从网上找了两种方法,效率差不多,这里贴出代码供大家参考
实体类Data
- public class Data {
- private Long id ;
- private Long courseId ;
- private String content ;
- public Long getId() {
- return id;
- }
- public Data setId(Long id) {
- this.id = id;
- return this ;
- }
- public Long getCourseId() {
- return courseId;
- }
- public Data setCourseId(Long courseId) {
- this.courseId = courseId;
- return this ;
- }
- public String getContent() {
- return content;
- }
- public Data setContent(String content) {
- this.content = content;
- return this ;
- }
- }

public class Data {
private Long id ;
private Long courseId ;
private String content ;
public Long getId() {
return id;
}
public Data setId(Long id) {
this.id = id;
return this ;
}
public Long getCourseId() {
return courseId;
}
public Data setCourseId(Long courseId) {
this.courseId = courseId;
return this ;
}
public String getContent() {
return content;
}
public Data setContent(String content) {
this.content = content;
return this ;
}
}
排序类
- <pre name="code" class="java">import java.lang.reflect.Method;
- import java.util.ArrayList;
- import java.util.Collection;
- import java.util.HashMap;
- import java.util.Iterator;
- import java.util.List;
- import java.util.Map;
- import com.framework.util.ParamUtils;
- public class CommonUtils {
- /**
- * 分組依據接口,用于集合分組時,獲取分組依據
- *
- * @author ZhangLiKun
- * @title GroupBy
- * @date 2013-4-23
- */
- public interface GroupBy<T> {
- T groupby(Object obj);
- }
- /**
- *
- * @param colls
- * @param gb
- * @return
- */
- public static final <T extends Comparable<T>, D> Map<T, List<D>> group(Collection<D> colls, GroupBy<T> gb) {
- if (colls == null || colls.isEmpty()) {
- System.out.println("分組集合不能為空!");
- return null;
- }
- if (gb == null) {
- System.out.println("分組依據接口不能為Null!");
- return null;
- }
- Iterator<D> iter = colls.iterator();
- Map<T, List<D>> map = new HashMap<T, List<D>>();
- while (iter.hasNext()) {
- D d = iter.next();
- T t = gb.groupby(d);
- if (map.containsKey(t)) {
- map.get(t).add(d);
- } else {
- List<D> list = new ArrayList<D>();
- list.add(d);
- map.put(t, list);
- }
- }
- return map;
- }
- /**
- * 将List<V>按照V的methodName方法返回值(返回值必须为K类型)分组,合入到Map<K, List<V>>中<br>
- * 要保证入参的method必须为V的某一个有返回值的方法,并且该返回值必须为K类型
- *
- * @param list
- * 待分组的列表
- * @param map
- * 存放分组后的map
- * @param clazz
- * 泛型V的类型
- * @param methodName
- * 方法名
- */
- public static <K, V> void listGroup2Map(List<V> list, Map<K, List<V>> map, Class<V> clazz, String methodName) {
- // 入参非法行校验
- if (null == list || null == map || null == clazz || !ParamUtils.chkString(methodName)) {
- System.out.print("CommonUtils.listGroup2Map 入参错误,list:" + list + " ;map:" + map + " ;clazz:" + clazz + " ;methodName:" + methodName);
- return;
- }
- // 获取方法
- Method method = getMethodByName(clazz, methodName);
- // 非空判断
- if (null == method) {
- return;
- }
- // 正式分组
- listGroup2Map(list, map, method);
- }
- /**
- * 根据类和方法名,获取方法对象
- *
- * @param clazz
- * @param methodName
- * @return
- */
- public static Method getMethodByName(Class<?> clazz, String methodName) {
- Method method = null;
- // 入参不能为空
- if (null == clazz || !ParamUtils.chkString(methodName)) {
- System.out.print("CommonUtils.getMethodByName 入参错误,clazz:" + clazz + " ;methodName:" + methodName);
- return method;
- }
- try {
- method = clazz.getDeclaredMethod(methodName);
- } catch (Exception e) {
- System.out.print("类获取方法失败!");
- }
- return method;
- }
- /**
- * 将List<V>按照V的某个方法返回值(返回值必须为K类型)分组,合入到Map<K, List<V>>中<br>
- * 要保证入参的method必须为V的某一个有返回值的方法,并且该返回值必须为K类型
- *
- * @param list
- * 待分组的列表
- * @param map
- * 存放分组后的map
- * @param method
- * 方法
- */
- @SuppressWarnings("unchecked")
- public static <K, V> void listGroup2Map(List<V> list, Map<K, List<V>> map, Method method) {
- // 入参非法行校验
- if (null == list || null == map || null == method) {
- System.out.print("CommonUtils.listGroup2Map 入参错误,list:" + list + " ;map:" + map + " ;method:" + method);
- return;
- }
- try {
- // 开始分组
- Object key;
- List<V> listTmp;
- for (V val : list) {
- key = method.invoke(val);
- listTmp = map.get(key);
- if (null == listTmp) {
- listTmp = new ArrayList<V>();
- map.put((K) key, listTmp);
- }
- listTmp.add(val);
- }
- } catch (Exception e) {
- System.out.print("分组失败!");
- }
- }
- }

<pre name="code" class="java">import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map; import com.framework.util.ParamUtils; public class CommonUtils {/**
* 分組依據接口,用于集合分組時,獲取分組依據
*
* @author ZhangLiKun
* @title GroupBy
* @date 2013-4-23
*/
public interface GroupBy<T> {
T groupby(Object obj);
} /**
*
* @param colls
* @param gb
* @return
*/
public static final <T extends Comparable<T>, D> Map<T, List<D>> group(Collection<D> colls, GroupBy<T> gb) {
if (colls == null || colls.isEmpty()) {
System.out.println("分組集合不能為空!");
return null;
}
if (gb == null) {
System.out.println("分組依據接口不能為Null!");
return null;
}
Iterator<D> iter = colls.iterator();
Map<T, List<D>> map = new HashMap<T, List<D>>();
while (iter.hasNext()) {
D d = iter.next();
T t = gb.groupby(d);
if (map.containsKey(t)) {
map.get(t).add(d);
} else {
List<D> list = new ArrayList<D>();
list.add(d);
map.put(t, list);
}
}
return map;
}
/**
* 将List<V>按照V的methodName方法返回值(返回值必须为K类型)分组,合入到Map<K, List<V>>中<br>
* 要保证入参的method必须为V的某一个有返回值的方法,并且该返回值必须为K类型
*
* @param list
* 待分组的列表
* @param map
* 存放分组后的map
* @param clazz
* 泛型V的类型
* @param methodName
* 方法名
*/
public static <K, V> void listGroup2Map(List<V> list, Map<K, List<V>> map, Class<V> clazz, String methodName) {
// 入参非法行校验
if (null == list || null == map || null == clazz || !ParamUtils.chkString(methodName)) {
System.out.print("CommonUtils.listGroup2Map 入参错误,list:" + list + " ;map:" + map + " ;clazz:" + clazz + " ;methodName:" + methodName);
return;
} // 获取方法
Method method = getMethodByName(clazz, methodName);
// 非空判断
if (null == method) {
return;
} // 正式分组
listGroup2Map(list, map, method);
}
/**
* 根据类和方法名,获取方法对象
*
* @param clazz
* @param methodName
* @return
*/
public static Method getMethodByName(Class<?> clazz, String methodName) {
Method method = null;
// 入参不能为空
if (null == clazz || !ParamUtils.chkString(methodName)) {
System.out.print("CommonUtils.getMethodByName 入参错误,clazz:" + clazz + " ;methodName:" + methodName);
return method;
} try {
method = clazz.getDeclaredMethod(methodName);
} catch (Exception e) {
System.out.print("类获取方法失败!");
} return method;
}
/**
* 将List<V>按照V的某个方法返回值(返回值必须为K类型)分组,合入到Map<K, List<V>>中<br>
* 要保证入参的method必须为V的某一个有返回值的方法,并且该返回值必须为K类型
*
* @param list
* 待分组的列表
* @param map
* 存放分组后的map
* @param method
* 方法
*/
@SuppressWarnings("unchecked")
public static <K, V> void listGroup2Map(List<V> list, Map<K, List<V>> map, Method method) {
// 入参非法行校验
if (null == list || null == map || null == method) {
System.out.print("CommonUtils.listGroup2Map 入参错误,list:" + list + " ;map:" + map + " ;method:" + method);
return;
} try {
// 开始分组
Object key;
List<V> listTmp;
for (V val : list) {
key = method.invoke(val);
listTmp = map.get(key);
if (null == listTmp) {
listTmp = new ArrayList<V>();
map.put((K) key, listTmp);
}
listTmp.add(val);
}
} catch (Exception e) {
System.out.print("分组失败!");
}
}
}
测试类
- import java.util.ArrayList;
- import java.util.LinkedHashMap;
- import java.util.List;
- import java.util.Map;
- import com.framework.common.CommonUtils.GroupBy;
- public class Test {
- /**
- * @param args
- */
- public static void main(String[] args) {
- // 准备一个集合
- final int loop = 1000 * 1000;
- List<Data> list = new ArrayList<Data>(); // size=8 * loop
- for (int i = 0; i < loop; i++) {
- list.add(new Data().setId(1L).setCourseId(200010L).setContent("AAA"));
- list.add(new Data().setId(2L).setCourseId(200010L).setContent("BBB"));
- list.add(new Data().setId(3L).setCourseId(200011L).setContent("CCC"));
- list.add(new Data().setId(4L).setCourseId(200011L).setContent("DDD"));
- list.add(new Data().setId(5L).setCourseId(200010L).setContent("EEE"));
- list.add(new Data().setId(6L).setCourseId(200011L).setContent("FFF"));
- list.add(new Data().setId(7L).setCourseId(200010L).setContent("GGG"));
- list.add(new Data().setId(8L).setCourseId(200012L).setContent("HHH"));
- }
- // 进行分组 1
- long time = System.currentTimeMillis();
- Map<Long, List<Data>> map2 = new LinkedHashMap<Long, List<Data>>();
- CommonUtils.listGroup2Map(list, map2, Data.class, "getId");// 输入方法名
- long duration = System.currentTimeMillis() - time;
- System.out.println("分组一执行:" + duration + "毫秒!");
- // 分组二
- time = System.currentTimeMillis();
- Map<Long, List<Data>> map = CommonUtils.group(list, new GroupBy<Long>() {
- @Override
- public Long groupby(Object obj) {
- Data d = (Data) obj;
- return d.getCourseId(); // 分组依据为课程ID
- }
- });
- duration = System.currentTimeMillis() - time;
- System.out.println("分组二执行:" + duration + "毫秒!");
- }
- }

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map; import com.framework.common.CommonUtils.GroupBy; public class Test {/**
* @param args
*/
public static void main(String[] args) {
// 准备一个集合 final int loop = 1000 * 1000;
List<Data> list = new ArrayList<Data>(); // size=8 * loop
for (int i = 0; i < loop; i++) {
list.add(new Data().setId(1L).setCourseId(200010L).setContent("AAA"));
list.add(new Data().setId(2L).setCourseId(200010L).setContent("BBB"));
list.add(new Data().setId(3L).setCourseId(200011L).setContent("CCC"));
list.add(new Data().setId(4L).setCourseId(200011L).setContent("DDD"));
list.add(new Data().setId(5L).setCourseId(200010L).setContent("EEE"));
list.add(new Data().setId(6L).setCourseId(200011L).setContent("FFF"));
list.add(new Data().setId(7L).setCourseId(200010L).setContent("GGG"));
list.add(new Data().setId(8L).setCourseId(200012L).setContent("HHH"));
}
// 进行分组 1
long time = System.currentTimeMillis();
Map<Long, List<Data>> map2 = new LinkedHashMap<Long, List<Data>>();
CommonUtils.listGroup2Map(list, map2, Data.class, "getId");// 输入方法名 long duration = System.currentTimeMillis() - time; System.out.println("分组一执行:" + duration + "毫秒!"); // 分组二
time = System.currentTimeMillis();
Map<Long, List<Data>> map = CommonUtils.group(list, new GroupBy<Long>() {
@Override
public Long groupby(Object obj) {
Data d = (Data) obj;
return d.getCourseId(); // 分组依据为课程ID
}
}); duration = System.currentTimeMillis() - time; System.out.println("分组二执行:" + duration + "毫秒!"); }
}
<div id="digg" articleid="51500934">
<dl id="btnDigg" class="digg digg_disable" onclick="btndigga();">
<dt>顶</dt>
<dd>1</dd>
</dl>
<dl id="btnBury" class="digg digg_disable" onclick="btnburya();">
<dt>踩</dt>
<dd>0</dd>
</dl>
</div>
<div class="tracking-ad" data-mod="popu_222"><a href="javascript:void(0);" target="_blank"> </a> </div>
<div class="tracking-ad" data-mod="popu_223"> <a href="javascript:void(0);" target="_blank"> </a></div>
<script type="text/javascript">
function btndigga() {
$(".tracking-ad[data-mod='popu_222'] a").click();
}
function btnburya() {
$(".tracking-ad[data-mod='popu_223'] a").click();
}
</script>
<div style="clear:both; height:10px;"></div>
<div class="similar_article" style="">
<h4>我的同类文章</h4>
<div class="similar_c" style="margin:20px 0px 0px 0px">
<div class="similar_c_t">
<label class="similar_cur">
<span style="cursor:pointer" onclick="GetCategoryArticles('1088196','yangxiaojun9238','foot','51500934');">JAVASE学习笔记<em>(22)</em></span>
</label>
</div>
<div class="similar_wrap tracking-ad" data-mod="popu_141" style="max-height:195px;">
<a href="http://blog.csdn.net" style="display:none" target="_blank">http://blog.csdn.net</a>
<ul class="similar_list fl"><li><em>•</em><a href="http://blog.csdn.net/yangxiaojun9238/article/details/52234786" id="foot_aritcle_52234786undefined6286303496263972" target="_blank" title="Thumbnails操作图片发红的问题解决">Thumbnails操作图片发红的问题解决</a><span>2016-08-17</span><label><i>阅读</i><b>342</b></label></li> <li><em>•</em><a href="http://blog.csdn.net/yangxiaojun9238/article/details/8493088" id="foot_aritcle_8493088undefined4650400583232628" target="_blank" title="jsonlib json,xml,object 互转">jsonlib json,xml,object 互转</a><span>2013-01-11</span><label><i>阅读</i><b>1839</b></label></li> <li><em>•</em><a href="http://blog.csdn.net/yangxiaojun9238/article/details/8250601" id="foot_aritcle_8250601undefined2811853968223248" target="_blank" title="JAVA批量修改文本文件内容,支持子目录">JAVA批量修改文本文件内容,支持子目录</a><span>2012-12-03</span><label><i>阅读</i><b>3593</b></label></li> <li><em>•</em><a href="http://blog.csdn.net/yangxiaojun9238/article/details/7337293" id="foot_aritcle_7337293undefined09073856205329212" target="_blank" title="java和oracle日期互转">java和oracle日期互转</a><span>2012-03-09</span><label><i>阅读</i><b>5933</b></label></li> <li><em>•</em><a href="http://blog.csdn.net/yangxiaojun9238/article/details/7324817" id="foot_aritcle_7324817undefined2789552682571841" target="_blank" title="对BigDecimal常用方法的归类">对BigDecimal常用方法的归类</a><span>2012-03-06</span><label><i>阅读</i><b>233</b></label></li> </ul>
<ul class="similar_list fr"><li><em>•</em><a href="http://blog.csdn.net/yangxiaojun9238/article/details/10171861" id="foot_aritcle_10171861undefined8352417148090185" target="_blank" title="poi excel 多级联动">poi excel 多级联动</a><span>2013-08-22</span><label><i>阅读</i><b>1818</b></label></li> <li><em>•</em><a href="http://blog.csdn.net/yangxiaojun9238/article/details/8488199" id="foot_aritcle_8488199undefined14007191595192148" target="_blank" title="java获得网页源代码">java获得网页源代码</a><span>2013-01-10</span><label><i>阅读</i><b>338</b></label></li> <li><em>•</em><a href="http://blog.csdn.net/yangxiaojun9238/article/details/7349548" id="foot_aritcle_7349548undefined16425431161098203" target="_blank" title="properties配置文件操作实例">properties配置文件操作实例</a><span>2012-03-13</span><label><i>阅读</i><b>543</b></label></li> <li><em>•</em><a href="http://blog.csdn.net/yangxiaojun9238/article/details/7336762" id="foot_aritcle_7336762undefined8513629169728651" target="_blank" title="java与oracle日期格式">java与oracle日期格式</a><span>2012-03-09</span><label><i>阅读</i><b>1471</b></label></li> <li><em>•</em><a href="http://blog.csdn.net/yangxiaojun9238/article/details/7312426" id="foot_aritcle_7312426undefined10967811199926958" target="_blank" title="日期转换">日期转换</a><span>2012-03-02</span><label><i>阅读</i><b>174</b></label></li> </ul>
<a href="http://blog.csdn.net/yangxiaojun9238/article/category/1088196" class="MoreArticle">更多文章</a></div>
</div>
</div>
<script type="text/javascript">
$(function () {
GetCategoryArticles('1088196', 'yangxiaojun9238','foot','51500934');
});
</script>
<div>
<div class="J_adv" data-view="true" data-mod="ad_popu_205" data-mtp="43" data-order="114" data-con="ad_content_1900" style="width: 728px; height: 90px;"><script src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><ins class="adsbygoogle" style="display:inline-block;width:728px;height:90px" data-ad-client="ca-pub-8990951720398508" data-ad-slot="8267689356/3776917242" data-adsbygoogle-status="done"><ins id="aswift_0_expand" style="display:inline-table;border:none;height:90px;margin:0;padding:0;position:relative;visibility:visible;width:728px;background-color:transparent"><ins id="aswift_0_anchor" style="display:block;border:none;height:90px;margin:0;padding:0;position:relative;visibility:visible;width:728px;background-color:transparent"><iframe width="728" height="90" frameborder="0" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no" allowfullscreen="true" onload="var i=this.id,s=window.google_iframe_oncopy,H=s&&s.handlers,h=H&&H[i],w=this.contentWindow,d;try{d=w.document}catch(e){}if(h&&d&&(!d.body||!d.body.firstChild)){if(h.call){setTimeout(h,0)}else if(h.match){try{h=s.upd(h,i)}catch(e){}w.location.replace(h)}}" id="aswift_0" name="aswift_0" style="left:0;position:absolute;top:0;"></iframe></ins></ins></ins><script>(adsbygoogle=window.adsbygoogle || []).push({});</script></div>
</div>
.blog-ass-articl dd {
color: #369;
width: 99%; /*修改行*/
float: left;
overflow: hidden;
font: normal normal 12px/23px "SimSun";
height: 23px;
margin: 0;
padding: 0 0 0 10px;
margin-right: 30px;
background: url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px;
}
参考知识库
<dt><span>猜你在找</span></dt>
<div id="adCollege" style="width: 42%;float: left;">
<script src="http://csdnimg.cn/jobreco/job_reco.js" type="text/javascript"></script>
<script type="text/javascript">
csdn.position.showEdu({
sourceType: "blog",
searchType: "detail",
searchKey: "51500934",
username: "",
recordcount: "5",
containerId: "adCollege" //容器DIV的id。
});
</script>
<div class="tracking-ad" data-mod="popu_84"><dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px; white-space: nowrap;"><a href="http://edu.csdn.net/course/detail/2981" title="java语言从入门到精通2016+项目实训" strategy="v4:content" target="_blank">java语言从入门到精通2016+项目实训</a></dd><dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px; white-space: nowrap;"><a href="http://edu.csdn.net/course/detail/3767" title="JavaScript面向对象的编程视频课程第二季 对象" strategy="v4:content" target="_blank">JavaScript面向对象的编程视频课程第二季 对象</a></dd><dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px; white-space: nowrap;"><a href="http://edu.csdn.net/course/detail/765" title="深入浅出Java的反射" strategy="v4:content" target="_blank">深入浅出Java的反射</a></dd><dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px; white-space: nowrap;"><a href="http://edu.csdn.net/course/detail/3577" title="java核心技术精讲" strategy="v4:content" target="_blank">java核心技术精讲</a></dd><dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px; white-space: nowrap;"><a href="http://edu.csdn.net/course/detail/395" title="零基础学Java系列从入门到精通" strategy="v4:content" target="_blank">零基础学Java系列从入门到精通</a></dd></div></div>
<div id="res" data-mod="popu_36" class="tracking-ad" style="width: 42%; float: left; margin-right: 30px; display: block;"><dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px;"><a href="http://blog.csdn.net/awj321000/article/details/25862015" title="HIBERNATE - 符合Java习惯的关系数据库持久化 Hibernate参考文档" strategy="SearchAlgorithm" target="_blank">HIBERNATE - 符合Java习惯的关系数据库持久化 Hibernate参考文档</a></dd><dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px;"><a href="http://blog.csdn.net/guomei/article/details/46689569" title="Java 运行时监控第 3 部分 监控应用程序生态系统的性能与可用性" strategy="SearchAlgorithm" target="_blank">Java 运行时监控第 3 部分 监控应用程序生态系统的性能与可用性</a></dd><dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px;"><a href="http://blog.csdn.net/u010185526/article/details/38229803" title="Java 运行时监控第 3 部分 监控应用程序生态系统的性能与可用性" strategy="SearchAlgorithm" target="_blank">Java 运行时监控第 3 部分 监控应用程序生态系统的性能与可用性</a></dd><dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px;"><a href="http://blog.csdn.net/allenjay11/article/details/53331855" title="JAVA 笔记三 从源码深入浅出集合框架" strategy="SearchAlgorithm" target="_blank">JAVA 笔记三 从源码深入浅出集合框架</a></dd><dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px;"><a href="http://blog.csdn.net/matry521/article/details/52210139" title="Java面试题整理" strategy="SearchAlgorithm" target="_blank">Java面试题整理</a></dd></div>
<div id="ad_cen">
<!-- 广告位开始 -->
<div class="J_adv" data-view="true" data-mod="ad_popu_72" data-mtp="62" data-order="40" data-con="ad_content_2072"><script id="popuLayer_js_q" src="http://ads.csdn.net/js/popuLayer.js" defer="" type="text/javascript"></script><div id="layerd" style="position: fixed; bottom: 0px; right: 0px; line-height: 0px; z-index: 1000; width: 300px; height: 278px; display: none;"><div class="J_close layer_close" style="display:;background-color:#efefef;padding:0px;color:#333;font:12px/24px Helvetica,Tahoma,Arial,sans-serif;text-align:right;">关闭</div><!-- 广告占位容器 --><div id="cpro_u2895327"><iframe id="iframeu2895327_0" src="http://pos.baidu.com/kcpm?rdid=2895327&dc=3&di=u2895327&dri=0&dis=0&dai=1&ps=908x1049&dcb=___adblockplus&dtm=HTML_POST&dvi=0.0&dci=-1&dpt=none&tsr=0&tpr=1487658161699&ti=JAVA%20%E9%9B%86%E5%90%88%20List%20%E5%88%86%E7%BB%84%E7%9A%84%E4%B8%A4%E7%A7%8D%E6%96%B9%E6%B3%95%20-%20yangxiaojun9238%E7%9A%84%E4%B8%93%E6%A0%8F%20-%20%E5%8D%9A%E5%AE%A2%E9%A2%91%E9%81%93%20-%20CSDN.NET&ari=2&dbv=2&drs=3&pcs=1349x662&pss=1349x6895&cfv=0&cpl=5&chi=1&cce=true&cec=UTF-8&tlm=1487658161&rw=662&ltu=http%3A%2F%2Fblog.csdn.net%2Fyangxiaojun9238%2Farticle%2Fdetails%2F51500934&ltr=https%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DpC3Lxw1Xt3JfbmAMHgh7oVjYwzMUN9sFs1ZAaQycQmmyj-D8goMg9RmG5vmVZoWnRA2o6P11em6uAlmJh6nid5-l3_Y_9X_WjZ1eejC6aSi%26wd%3D%26eqid%3De542833a000555170000000358abbc5c&ecd=1&par=1366x768&pis=-1x-1&ccd=24&cja=false&cmi=7&col=zh-CN&cdo=-1&sr=1366x768&tcn=1487658162&qn=b497df28aa28c99d&tt=1487658161683.20.21.24" width="300" height="250" align="center,center" vspace="0" hspace="0" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" style="border:0; vertical-align:bottom;margin:0;" allowtransparency="true"></iframe></div></div><script> document.getElementById('popuLayer_js_q').onload=function(){ var styObjd=styObj={width:'300px','height':parseInt(250)+28};window.CSDN.Layer.PopuLayer('#layerd',{storageName:'layerd',styleObj:styObjd,total:50,expoire:1000*60}); }</script><!-- 投放代码 --><script type="text/javascript"> /*服务器频道首页置顶Banner960*90,创建于2014-7-3*/ (window.cproArray = window.cproArray || []).push({ id: 'u2895327' }); </script> <script src="http://cpro.baidustatic.com/cpro/ui/c.js" type="text/javascript"></script></div>
<!-- 广告位结束 -->
<div id="ad_bot">
</div>
<a id="quick-reply" class="btn btn-top q-reply" title="快速回复" style="display:none;">
<img src="http://static.blog.csdn.net/images/blog-icon-reply.png" alt="快速回复">
</a>
<a id="d-top-a" class="btn btn-top backtop" style="display: none;" title="返回顶部" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_huidaodingbu'])">
<img src="http://static.blog.csdn.net/images/top.png" alt="TOP">
</a>
.tag_list
{
background: none repeat scroll 0 0 #FFFFFF;
border: 1px solid #D7CBC1;
color: #000000;
font-size: 12px;
line-height: 20px;
list-style: none outside none;
margin: 10px 2% 0 1%;
padding: 1px;
}
.tag_list h5
{
background: none repeat scroll 0 0 #E0DBD3;
color: #47381C;
font-size: 12px;
height: 24px;
line-height: 24px;
padding: 0 5px;
margin: 0;
}
.tag_list h5 a
{
color: #47381C;
}
.classify
{
margin: 10px 0;
padding: 4px 12px 8px;
}
.classify a
{
margin-right: 20px;
white-space: nowrap;
}
<h5>
<a href="http://www.csdn.net/tag/" target="_blank">核心技术类目</a></h5>
<div class="classify">
全部主题
Hadoop
AWS
移动游戏
Java
Android
iOS
Swift
智能硬件
Docker
OpenStack
VPN
Spark
ERP
IE10
Eclipse
CRM
JavaScript
数据库
Ubuntu
NFC
WAP
jQuery
BI
HTML5
Spring
Apache
.NET
API
HTML
SDK
IIS
Fedora
XML
LBS
Unity
Splashtop
UML
components
Windows Mobile
Rails
QEMU
KDE
Cassandra
CloudStack
FTC
coremail
OPhone
CouchBase
云计算
iOS6
Rackspace
Web App
SpringSide
Maemo
Compuware
大数据
aptech
Perl
Tornado
Ruby
Hibernate
ThinkPHP
HBase
Pure
Solr
Angular
Cloud Foundry
Redis
Scala
Django
Bootstrap
JAVA 集合 List 分组的两种方法的更多相关文章
- java字符串大小写转换的两种方法
转载自:飞扬青春sina blogjava字符串大小写转换的两种方法 import java.io..* public class convertToPrintString { pu ...
- java集合进行排序的两种方式
java集合的工具类Collections中提供了两种排序的方法,分别是: Collections.sort(List list) Collections.sort(List list,Compara ...
- List集合序列排序的两种方法
首先讲一下Comparable接口和Comparator接口,以及他们之间的差异.有助于Collections.sort()方法的使用.请参考 1.Comparable自然规则排序//在自定义类Stu ...
- java连接Access数据库的两种方法
where ziduan in(select ziduan from table) 嵌套 ResultSet rs = pst.executeQuery();List list = new Ar ...
- Java获得键盘输入的两种方法
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import ...
- Java获取当前类名的两种方法
适用于非静态方法:this.getClass().getName() 适用于静态方法:Thread.currentThread().getStackTrace()[1].getClassName() ...
- Java中HashMap遍历的两种方法(转)
第一种: Map map = new HashMap(); Iterator iter = map.entrySet().iterator(); while (iter.hasNext()) { Ma ...
- Java导出Excel文件的两种方法
将数据以Excel表格的形式导出:首先下载poi的jar包,导入项目中,或者使用maven仓库管理,在pom文件添加:<dependency> <groupId>org. ...
- Java遍历文件夹的两种方法(非递归和递归)
import java.io.File; import java.util.LinkedList; public class FileSystem { public static int num ...
随机推荐
- 九、Appium-python-UI自动化之通过text定位
1.通过xpath定位text xpath路径为://android.widget.EditText[@text='请输入包含街道的完整地址'] 2.通过AndroidUIAutomator # 这个 ...
- 蓝牙/zigbee/nrr24xx
目前使用的短距离无线通信技术及标准主要有Bluetooth.WIFI.ZigBee.UWB.NRF24XX系列产品等.Nordic公司生产的单片集成射频无线收发器NRF24XX系列芯片具有低功耗.支持 ...
- Update(stage3):第1节 redis组件:10、redis集群
10.redis集群 1.redis集群的介绍 Redis 集群是一个提供在多个Redis节点之间共享数据的程序集. Redis 集群并不支持同时处理多个键的 Redis 命令,因为这需要在多个节点间 ...
- mcast_set_if函数
#include <errno.h> #include <string.h> #include <net/if.h> #include <sys/ioctl. ...
- 第一节:Vuejs入门之各种指令
一. 简介 Vue (读音 /vjuː/,类似于 view) 是一套用于构建用户界面的渐进式框架.与其它大型框架不同的是,Vue 被设计为可以自底向上逐层应用.Vue 的核心库只关注视图层,不仅易于上 ...
- pycharm 右键无法显示unittest框架&&解决右键只有unittest 运行如何取消右键显示进行普通run
上面是普通文件和unittest 导入的文件右键快捷键显示情况,可以看出两者快捷键都是ctr+shift+F10,如果你是右键模式想运行unitest,但是又不知道哪里配置unittest直接运行快捷 ...
- 第七届蓝桥杯javaB组真题解析-四平方和(第八题)
题目 /* 四平方和 四平方和定理,又称为拉格朗日定理: 每个正整数都可以表示为至多4个正整数的平方和. 如果把0包括进去,就正好可以表示为4个数的平方和. 比如: 5 = 0^2 + 0^2 + 1 ...
- 最全Python学习路线图【2020最新版】
2020年最新的python学习大纲,专为python高薪打造另外很多人在学习Python的过程中,往往因为没有好的教程或者没人指导从而导致自己容易放弃,为此我建了个Python交流.裙 :一久武其而 ...
- UITextField的快速基本使用代码块
概述 UITextField在界面中显示可编辑文本区域的对象. 您可以使用文本字段来使用屏幕键盘从用户收集基于文本的输入.键盘可以配置许多不同类型的输入,如纯文本,电子邮件,数字等等.文本字段使用目标 ...
- 在spring boot中使用jasypt对配置文件中的敏感字符串加密
在spring boot的配置文件application.property(application.yml)文件中常常配置一些密码类的字符,如果用明文则很容易被盗用,可以使用jasypt在配置密码的地 ...



