类应该对扩展开放, 对修改关闭.所谓装饰者模式,
是指用其他的类来装饰某个类,装饰者说白了就是使用 has-a 来代替 is-a隐喻咖啡店, 有很多种咖啡, 咖啡里还要增加一些 milk, 面包片啊, 等等.
针对加的东西不同, 计算出来的费用不同, 那么我们需要怎么做呢?1. 首先创建一个 cof...
分类:
其他好文 时间:
2014-06-11 13:03:28
阅读次数:
349
1.1Implement an algorithm to determine if a
string has all unique characters. What if you cannot use additional data
structures?字符串问题,需要先确定是不是只有ASCII码...
分类:
其他好文 时间:
2014-06-11 12:27:53
阅读次数:
247
1: hibernate4.3.5
的@oneToOne注解有Bug,建议不使用该版本,或者使用该版本不使用@table
annotation.2:今天在用hibernate4.2.13的时候,在使用@oneToOne注解的时候报:java.lang.NoSuchMethodError:javax....
分类:
系统相关 时间:
2014-06-11 11:44:23
阅读次数:
347
在Linux上检出windows
SVN服务器上项目时出现了SSLhandshakefailed:SSLerror:Keyusageviolationincertificatehasbeendetected.的错误。最后通过从网上检索找到了一个答案:
可以同时解决掉在Ubuntu上和CentOS上检...
原文地址:http://www.cnblogs.com/royenhome/archive/2011/05/20/2051879.html异常场景:经常在应用中需要处理一些耗时的工作,诸如读取大文件、访问网络资源等。为了避免因程序假死而带来的糟糕用户体验,通常我们可以通过线程+Handler或者An...
分类:
移动开发 时间:
2014-06-11 10:01:47
阅读次数:
229
public voidnotifyDataSetChanged()Added inAPI
level 1Notifies the attached observers that the underlying data has been changed
and any View reflecting ...
分类:
移动开发 时间:
2014-06-11 07:44:51
阅读次数:
270
Catch That Cow
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 44070
Accepted: 13764
Description
Farmer John has been informed of the location of a fugitiv...
分类:
其他好文 时间:
2014-06-08 15:44:43
阅读次数:
238
本篇题目改编自自于唐代大诗人孟浩然的《春晓》,原句是这样“春眠不觉晓,处处闻啼鸟。夜来风雨声,花落知多少。”(多么美的诗句啊!微笑)
言归正传,本篇主要是记录下学习java中异常处理的感受和经历,分享给大家。...
分类:
其他好文 时间:
2014-06-08 10:36:06
阅读次数:
229
PathsumDescription:Given a binary tree and a
sum, determine if the tree has a root-to-leaf path such that adding up all the
values along the path equa...
分类:
其他好文 时间:
2014-06-08 01:11:46
阅读次数:
395
Given a binary tree and a sum, determine if the
tree has a root-to-leaf path such that adding up all the values along the path
equals the given sum.Fo...
分类:
其他好文 时间:
2014-06-07 16:55:09
阅读次数:
173