publicstatic<T>voidfromArrayToCollection(T[] a, Collection<T> c){for(T o : a){
c.add(o);}}publicstaticvoidmain(String[] args){
Object[] ao =newObject[100];
Collection<Object> co =newArrayList<Object>();fromArrayToCollection(ao, co);
String[] sa =newString[20];
Collection<String> cs =newArrayList<>();fromArrayToCollection(sa, cs);
Collection<Double> cd =newArrayList<>();// 下面代码中T是Double类,但sa是String类型,编译错误。// fromArrayToCollection(sa, cd);// 下面代码中T是Object类型,sa是String类型,可以赋值成功。fromArrayToCollection(sa, co);}
classCreature{}classPersonextendsCreature{}classManextendsPerson{}classPersonTest{publicstatic<T extendsPerson>voidtest(T t){
System.out.println(t);}publicstaticvoidmain(String[] args){test(newPerson());test(newMan());//The method test(T) in the type PersonTest is not //applicable for the arguments (Creature)test(newCreature());}}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml&q
// for循环的进化
// 菜鸟
for (var i = 0; i < Things.length ; i++) {
// Things[i]
}
// 老鸟
for (var i = 0, len = Things.length; i < len; i++) {
// Things[i]
}
// 大师
for (var i = Things.le
the idea is from:
http://blog.csdn.net/zhanxinhang/article/details/6731134
public class MaxSubMatrix {
/**see http://blog.csdn.net/zhanxinhang/article/details/6731134
* Q35
求一个矩阵中最大的二维
使用cordova可以很方便的在手机sdcard中读写文件。
首先需要安装cordova插件:file
命令为:
cordova plugin add org.apache.cordova.file
然后就可以读写文件了,这里我先是写入一个文件,具体的JS代码为:
var datas=null;//datas need write
var directory=&
SELECT cust_id,
SUM(price) as total
FROM orders
WHERE status = 'A'
GROUP BY cust_id
HAVING total > 250
db.orders.aggregate( [
{ $match: { status: 'A' } },
{
$group: {