码迷,mamicode.com
首页 >  
搜索关键字:list    ( 54897个结果
编写高质量代码改善C#程序的157个建议——建议22:确保集合的线程安全
建议22:确保集合的线程安全集合线程安全是指多个线程上添加或删除元素时,线程键必须保持同步。下面代码模拟了一个线程在迭代过程中,另一个线程对元素进行了删除。 class Program { static List list = new List() {...
分类:编程语言   时间:2015-08-14 18:57:12    阅读次数:145
leetcode:Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the...
分类:其他好文   时间:2015-08-14 17:06:51    阅读次数:125
动态viewpager加载图片
传入网络图片地址就行了public class MyPagerAdapter extends PagerAdapter { private List viewlist; private Context mContext; public MyPagerAdapter(List viewlist, Context mContext) {...
分类:其他好文   时间:2015-08-14 15:45:21    阅读次数:125
List<T>线性查找和二分查找BinarySearch效率分析
今天因为要用到List的查找功能,所以写了一段测试代码,测试线性查找和二分查找的性能差距,以决定选择哪种查找方式。线性查找:Contains,Find,IndexOf都是线性查找。二分查找:BinarySearch,因为二分查找必须是对有序数组才有效,所以查找前要调用List的Sort方法。结论:如...
分类:其他好文   时间:2015-08-14 15:03:20    阅读次数:91
Emacs 使用graphviz-dot-mode创建架构图
首先要安装graphviz-dot-mode模块,list-packages的站点国内无法访问,改为手动下载graphviz-dot-model.el,放到~/.emacs.d/目录下。然后修改init.el文件:;; graphviz-dot-model (load-file "~/.emacs.d/graphviz-dot-model.el")ubutnu系统下要安装graphviz程序,ap...
分类:系统相关   时间:2015-08-14 13:54:13    阅读次数:920
leetcode 题解代码整理 21-25题
Merge Two Sorted Lists Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 合并两个有序链表 ...
分类:其他好文   时间:2015-08-14 13:48:23    阅读次数:86
set集合容器
set集合容器是使用红黑树[一种二叉检索树的数据结构]来组织泛化的元素数据。元素数据的检索使用的是二叉检索树的中序遍历算法,检索的效率高于vector、deque、和list等容器,由于采用中序遍历算法可以将二叉检索树中的键值由小到大遍历出来,所以set集合容器蕴含了元素间的有序性。红黑树的每个节点包含一个取值为红色或者黑色的颜色域,节点键值的插入必须确保树根节点的键值大于左子树所有节点的键值,而小...
分类:其他好文   时间:2015-08-14 13:43:47    阅读次数:274
集合总结-1
//学习方法,不要因为一点小问题而导致大技术的学习。//学习方法不在于听,而在做,并坚持。节省时间必须要敲代码。一、Collection 接口(子接口:Set 、 List) ★ Collection体系的共性方法(比特有方法还重要) (1) 【添加】操作 boolean add(Objec...
分类:其他好文   时间:2015-08-14 13:40:13    阅读次数:117
jdk1.8.0_45源码解读——ArrayList的实现
jdk1.8.0_45源码解读——ArrayList的实现一、ArrayList概述 ArrayList是List接口的可变数组的实现。实现了所有可选列表操作,并允许包括 null 在内的所有元素。除了实现 List 接口外,此类还提供一些方法来操作内部用来存储列表的数组的大小。 每个Array.....
分类:其他好文   时间:2015-08-14 13:33:44    阅读次数:215
Generic泛型
1.问题未使用泛型时,元素的类型不安全;操作麻烦,可能需要强制转换import java.util.ArrayList;import java.util.List;import org.junit.Test;import day8.Customer;public class GenericTest ...
分类:其他好文   时间:2015-08-14 13:21:41    阅读次数:146
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!