Method 1: Add one list into the other list.
For example, if list1is {22, 33, 44, 55} and list2 is {66, 77, 88, 99},then append(list1, list2)will change list1to {22, 33, 44, 55, 44, 66, 77, 88, 99}.
...
分类:
其他好文 时间:
2014-07-08 16:18:22
阅读次数:
196
简单工程模式:对具有相同功能的类进行抽象得到父类,这些类继承它成为子类。为了对这些功能进行选择,建立一个工厂类进行判断,其中运用一个Switch语句。
优点:结构简单、操作单一。
缺点:需要事先考虑周到,操作时需准确。由下的“功能扩展”中可知,易违背设计模式六大原则中的“开放-封闭原则”。
功能扩展:若增添功能方法,则需另添加一个类,在运算类中添加的相应的方法,再修改客户端中的Switch语句中的case项。
工厂方法模式(Factory Method):先建立一个...
分类:
其他好文 时间:
2014-07-08 14:34:46
阅读次数:
211
Method 4: Gets the value of element number i
For example, if list is {22, 33, 44, 55, 66, 77, 88, 99}, then get(list, 2) will return 44.
Solution 1:
static int get(Node list, int i) {
if (i < 0) ...
分类:
其他好文 时间:
2014-07-08 14:07:52
阅读次数:
262
??
// TODO Auto-generated method stub
//获取本地主机IP对象
InetAddress ip = InetAddress.getLocalHost();
System.out.println(ip.getHostAddress());
System.out.println(ip.getHostName());
//获取其他主...
分类:
编程语言 时间:
2014-07-08 12:58:09
阅读次数:
278
/**************可变参数的使用*****************///注意:可变参数一定要放在参数列表的最后,使用时是作为数组来进行操作//public static void main(String[] args) {//method("总和为:",10,50,20);//metho...
分类:
其他好文 时间:
2014-07-06 17:11:31
阅读次数:
175
Update: July 4, 2014 Chap 5: At the beginning, he mentioned that: recursion is a divide-and-conquer method. Although many algorithms can be solved in ...
分类:
其他好文 时间:
2014-07-06 15:24:36
阅读次数:
213
/****************************************************************** find the biggest x number in a sequence* the basic method is the same as the Quic....
分类:
其他好文 时间:
2014-07-06 13:12:01
阅读次数:
176
action学习笔记2-有关于action method的讨论
Action执行的时候并不一定要执行execute方法,可以在配置文件中配置Action的时候用method=来指定执行哪个方法
也可以在url地址中动态指定(动态方法调用DMI)(推荐)
方法一
//方法一
/user_add_success.j...
分类:
Web程序 时间:
2014-07-06 08:54:22
阅读次数:
213
Description: Given two strings, write a method to decide if one is a permutation of the other.We could use the same idea from CTCI 1.1. The only diffe...
分类:
其他好文 时间:
2014-07-05 21:43:01
阅读次数:
231
struts2上传图片的过程1、写一个上传的jsp页面upload_image.jsp,内容如下: 解析:A、 form里面的method必须是post,enctype="multipart/form-data"上传文件必须这样写 B、这个是图片格式或者大小出...
分类:
其他好文 时间:
2014-07-05 20:59:18
阅读次数:
218