- 浏览: 798604 次
- 性别:
- 来自: 上海
最新评论
-
心存高远:
谢谢作者分享,刚好看到这里不太明白,现在茅塞顿开。不过runt ...
关于 Maven的传递依赖的理解 -
sxlkk:
851228082 写道甚至在某次技术会议现场遇到《Maven ...
关于 Maven的传递依赖的理解 -
851228082:
851228082 写道a----compile----b-- ...
第五章 坐标和依赖 -
851228082:
a----compile----b-----provided- ...
第五章 坐标和依赖 -
851228082:
甚至在某次技术会议现场遇到《Maven in action》的 ...
关于 Maven的传递依赖的理解
文章列表
Immutable objects are highly desirable. Because an immutable object's state cannot be changed, they are particularly useful in concurrent environments. Immutable options can simplify code and reduce chances of unanticipated and undesired state in objects.I prefer that all of my Java classes provide ...
今天听一友人说了一道在google的面试题,题目是这样的:有一个M*N的矩阵,要求你以“Z”字型遍历矩阵。
例如,如果输入为 5 * 10的矩阵:
[00, 02, 03, 09, 10, 19, 20, 29, 30, 39][01, 04, 08, 11, 18, 21, 28, 31, 38, 40][05, 07, 12, 17, 22, 27, 32, 37, 41, 46][06, 13, 16, 23, 26, 33, 36, 42, 45, 47][14, 15, 24, 25, 34, 35, 43, 44, 48, 49]
则输出为: 00 , 01 , 02 ...
Practically every request from a user's JSP/servlet creates a new database connection, which takes time and exhausts system resources. Using a limited number of database connections substantially improves Web server productivity and eases the load on your database. To the extent that servlets enable ...
现在是2010/10/03 日凌晨4:50,可能是"WeakReference 与 PhantomReference 加入ReferenceQueue时机的疑惑 "一文中提出的问题没有解决一直睡不着吧:P 突然想到去check一下这个项目用的JRE,发现自己太粗心了,虽然Eclipse启动是用的SUN JRE1.6,但这个项目配置的却是系统上装的另一个IBM JRE1.5。所以在"WeakReference 与 PhantomReference 加入ReferenceQueue时机的疑惑 "一文的评论中我所贴的实际上是IBM JRE1.5的原码,所以我便 ...
1) You can step through the list of enum constants by calling values( ) on the enum. The values( ) method produces an array of the enum constants in the order in which they were declared, so you can use the resulting array in (for example) a foreach loop.
2) When you create an enum, an associate ...
适用情况:当抽象本身有很复杂的层次结构(继承关系),如果你继续用“继承”来实现这些抽象的话,那每一种实现都要继承抽象层次结构中的每一个分支,同时当抽象层次分支增加时,你又要为新增的分支“继承”每一种不同的实现。所以你希望抽象与实现完全分开,他们都可以有自己的层次结构。同时实现之间的转换对系统来说是透明的。
解决方案:在顶层的抽象类中包含一个顶层实现类的引用。通过将功能委派给这个引用来实现抽象类的功能。在不同的实现之间切换时,只需要变更这个引用所指向的具体实现就行了。
类图:
GOF中的例子:
实际应用:其实很典型(完全符合定义类图 ...
适用情况:当一个已经存在的类库或类所提供的功能符合系统的要求,但由于其提供的接口不符合系统的要求, 从而无法与系统中的其它类合作时。
解决方案:定义一个Adapter类,实现系统要求的接口,同时继承已有类或者包含一个已有类对象的成员。通过将实际功能委派给已有类的方法来实现系统类的接口。
类图:
Class Adapter
Object Adapter
GOF中的例子:
...
1) The File class has a deceiving name; you might think it refers to a file, but it doesn’t. In fact, "FilePath" would have been a better name for the class. It can represent either the name of a particular file or the names of a set of files in a directory. If it’s a set of files, you ca ...
1) Although it is based on C++, Java is more of a “pure” object-oriented language. Both C++ and Java are hybrid languages, but in Java the designers felt that the hybridization was not as important as it was in C++. A hybrid language allows multiple programming styles while the Java language assume ...
1) Java SE5 adds:
a. The Queue interface (which LinkedList has been modified to implement) and its implementations PriorityQueue and various flavors of BlockingQueue for use in threading.
b. A ConcurrentMap interface and its implementation ConcurrentHashMap, also for use in threading. ...
1) There are three issues that distinguish arrays from other types of containers: efficiency, type, and the ability to hold primitives. The array is Java’s most efficient way to store and randomly access a sequence of object references. Arrays are superior to pre-generic containers because you crea ...
1) Generics are one of the more significant changes in Java SE5. Generics implement the concept of parameterized types, which allow multiple types. The term "generic" means "pertaining or appropriate to large groups of classes." The original intent of generics in programming lan ...
1) If an object appears in a string concatenation expression (involving '+' and String objects), the toString( ) method is automatically called to produce a String representation for that object.
2) RTTI(Runtime Type Information) means : At run time, the type of an object is identified.
3 ...
1) Objects of the String class are immutable. Every method in the String class that appears to modify a String actually creates and returns a brand new String object containing the modification. The original String is left untouched.
2) The '+' and '+=' for String are the only operators that ar ...
1) An exceptional condition is a problem that prevents the continuation of the current method or scope. It’s important to distinguish an exceptional condition from a normal problem, in which you have enough information in the current context to somehow cope with the difficulty. With an exceptional ...