- 浏览: 27093 次
最新评论
文章列表
1. 泛型类。在类名后面声明泛型变量。
class GenericMap<T extends Number, E extends Date> extends HashMap<T, List<E>> {
....
}
new GenericMap<Integer, Time>()的时候才最终绑定T(Integer)和E(Time)。所以这个map的get方法实际上变成了
public List<Time> get(Integer key) {
return super.get(key);
}
2. ...
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> < ...
A lambda expression is basically just a block of code that you can pass around to be executed later – once, or multiple times. Many other languages support them, so you’ve probably already used them if you’ve coded in a language other than C/C++/Java/C# (they’re also often referred to as ‘Closures’, ...
1. Some dependencies those running well in Java6/Java7 but not Java8
e.g. javassist.jar, it's quite probably be inconsistent
2. Got SAX warning in console. That's because Java8 denies to access the external xsd/dtd files by default but some dependencies of your project might need to access ...
import java.io.FileInputStream;import java.io.FileOutputStream;import java.io.IOException;import java.security.InvalidAlgorithmParameterException;import java.security.InvalidKeyException;import java.security.KeyStore;import java.security.KeyStore.PasswordProtection;import java.security.KeyStore.Sec ...
1.ThreadLocal干什么的?
ThreadLocal是用来做线程内部变量传递的,绝非线程间通信或线程同步的!
2. ThreadLocal工作原理
是每个Java线程拥有一个ThreadLocal.ThreadLocalMap的成员变量,这个map的key就是ThreadLocal对象,value就是当前线程的目标变量的包装类Entry。而绝非ThreadLocal为每个thread保存变量,这很重要。
所以当线程消亡的时候,其相关的threadLocal的变量自然就被GC了。
3. ThreadLocal保存变量的生命周期是怎么样的?
ThreadLocal保 ...
Attachment only
Attachment only
SAX: Simple API for XML
DOM: Document Object Model
JAXP: Java API for XML Processing
StAX: The Streaming API for XML
1、SAX, DOM是两种对xml文档进行分析的方法(没有具体的实现,只有接口)所以他们不是解释器,仅仅靠他们是完成不了对xml文档的处理的。
sax的包是org.xml.sax
dom的包是org.w3c.dom
包的名称很重要,它有助于你理解他们之间的关系。 可见,DOM是W3C的官方规范。
容易混淆的是,人们常说用JDK中自带的SAX/ ...
For kit based dependency management, I found that “importing dependencies” in maven will serve this purpose very well. For example ,we have two kit cib-kit and rm-kit,
In cib-kit, we can specify the artifacts need to be exposed to other kit and their versions.
<dependencyManagement> ...
Tomcat对于GET请求的url和参数默认使用iso-8859-1编码,因此,tomcat将会使用iso-8859-1将提交的字节转换成字符串。
所以,对于使用get方式传值的时候,统一使用String str= new String(req.getParameter("str").toString().getBytes("iso8859_1"), "UTF-8");
在SpringMVC中@PathVariable自动绑定的中文参数也会遇到同样的情况(尤其在Linux系统上),
str = new String(str ...
编译安装hadoop2.6
- 博客分类:
- bigdata
准备:
1.安装gcc
yum install gcc
yum install gcc-c++
2.安装jdk(注意必须jdk,jre不行)
3.ProtocolBuffer 2.5.0
wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.bz2
tar jxvf protobuf-2.5.0.tar.bz2
cd protobuf-2.5.0.tar.bz2
./configure --prefix=/usr/local/protobuf ...
一个function, 从语法的角度讲,既可以使用括号让其执行,也可以new它,比如
fucntion a(){}
var b = a();
var c = new a();
对 于c来说,a方法同样会执行,需要注意的是,如果a方法有return语句,那么b和c的值都是这个被return的东西;如果a方法根本没有任何 reutrn,那么b的值是undefined,对于c来说,a方法等同于最后会被默认加上一个retrun this,所以c会拿到一个对象。
再看另一个方法,
function a() { console.log(this); this.prototyp ...
看几个case:
-------------------------------1. -------------------------------
<script>var name = 1;function test1() { alert(name); var name = 2; alert(name); for(var i=0; i<10; i++) { var j = 100; } alert(i); alert(j);}</script>
alert依次出现:undefined, 2, ...