为什么80%的码农都做不了架构师?>>>
然而江湖传言有不世神功叫北冥神功,“北冥有鱼,其名为鲲,鲲之大,不知其几千里也……”,能够容纳几千里的大鱼必定是非常广阔的海洋,因而北冥神功正是寓含了广大恢宏之意,也体现了神功的威力。“可以吸取他人的内力以供己用,是迅速提升功力的捷径。内力既厚,天下武功无不为我所用,犹如北冥,大舟小舟无不载,大鱼小鱼无不容。”
.NET派的几位高人闭关苦练,竟然悟出北冥神功,此神功后曰:IKVM.NET.
江湖后辈小子Ray Linn偶习此神功,得心得一二,不敢自珍,特此记之,以壮大我.NET门派,千秋万代,一统江湖。
那日Ray偶来到apache支派,却看到Apache弟子们各施绝技,好不热闹. Ray对Apache绝技手痒已久,想来得习IKVM.NET已有时日,斗胆上前叫阵。迎战者哪Apache派中的小弟子,江湖人称:commons.collection.
二人拳脚来去,Ray却懒得与之多动手脚,随即默念真言:
ikvmc -assembly:commons -target:library -version:1.0.0.0 commons-collections-3.2.1.jar
collection陡然萎靡在地,想是一身内功尽被Ray所吸去,Apache派人等尽皆失色,“我等苦练十余载,内力尽为汝一夕取去”,莫敢上前。
Ray回转.NET派,试练collection的神功,借助IKVM.OpenJDK.Core之神器,神功即成,试演如下:
using System;using org.apache.commons.collections;
using org.apache.commons.collections.functors;namespace MyLib
{class Program{static void Main(string[] args){String name = "Tim";Predicate nameJohn = new EqualPredicate( "John" );Predicate nameTim = new EqualPredicate( "Tim" );Predicate instanceString = new InstanceofPredicate(typeof(String) );Predicate instanceDouble = new InstanceofPredicate(typeof(Double));Console.Out.WriteLine( "Is Name John?: " + nameJohn.evaluate( name ) );Console.Out.WriteLine("Is Name Tim?: " + nameTim.evaluate(name));Console.Out.WriteLine( "Is this a String?: " + instanceString.evaluate( name ) );Console.Out.WriteLine( "Is this a Double?: " + instanceDouble.evaluate( name ) );}}
}
相较原有神功:
import org.apache.commons.collection.Predicate;
import org.apache.commons.collection.functors.*;
String name = "Tim";
Predicate nameJohn = new EqualPredicate( "John" );
Predicate nameTim = new EqualPredicate( "Tim" );
Predicate instanceString = new InstanceofPredicate( String.class );
Predicate instanceDouble = new InstanceofPredicate( Double.class );
// Testing all predicates for "Tim"
System.out.println( "Is Name John?: " + nameJohn.evaluate( name ) );
System.out.println( "Is Name Tim?: " + nameTim.evaluate( name ) );
System.out.println( "Is this a String?: " + instanceString.evaluate( name ) );
System.out.println( "Is this a Double?: " + instanceDouble.evaluate( name ) );
竟然绝无二致。
偌大Java江湖,从此为我.NET所用,哇哈哈。
作者: ray_linn
声明: 本文系JavaEye网站发布的原创文章,未经作者书面许可,严禁任何网站转载本文,否则必将追究法律责任!
已有 48 人发表回复,猛击->>这里<<-参与讨论
JavaEye推荐
- 上海:天会皓闻诚聘CTO技术总监
- 上海:天会皓闻诚聘资深Java架构师
- 北京:手机之家网站诚聘PHP程序员
- 成都:月薪5千到1万招聘Java开发工程师
- 上海:高薪诚聘Python开发人员