IKVM 编程武林之.NET派的北冥神功-哇哈哈!!

在编程武林中,Java派成立较久底细雄厚,尽管掌门人Sun已经老气横秋,乡山之技的Java语言已经被后进的后起之秀.NET派的C#压得喘不过气来,甚至有时Sun头儿还得跑到.NET派打掩护学艺。但是百足之虫,死而不僵,一众Java派的拥趸们自认诚然Java逐渐技不如人,但是Java派成立日久,从Java演变过来的七十二门绝招远非武林暴发户.NET派所能比拟,内中几大支使如apache,springsource各有绝招,而派生出的帮会、匪帮之类更其不可胜数,.NET派不可企及。

然则江湖传说有不世神功叫北冥神功,“北冥有鱼,其名叫鲲,鲲之大,不知其几千里也……”,能够容纳几千里的大鱼必定是是非非常辽阔的大洋,因此北冥神功恰是寓含了宽广伸张之意,也反映了神功的威力。“可以吸取旁人的内功以供己用,是迅速擢升功底的近路。内功既厚,天下武功无不为我所用,宛如北冥,大舟小舟无不载,大鱼小鱼无不容。”

.NET派的几位圣人闭关苦练,居然体悟北冥神功,此神功后曰:IKVM.NET.

江湖后辈小子Ray Linn偶习此神功,得经验一二,不敢自珍,特此记之,以扩大我.NET门派,万古千秋,一统江湖。

那日Ray偶赶来apache支系,却看到Apache学徒们各施绝招,好不热烈. Ray对Apache绝招手痒已久,想来得习IKVM.NET已有时候日,斗胆上前叫阵。应战者哪Apache派中的小学徒,江湖人称:commons.collection.

二人拳脚来去,Ray却懒得与之多动手脚,过后默念真言:

Java代码
一.ikvmc -assembly:commons -target:library -version:1.0.0.0 commons-collections-3.2.1.jar
ikvmc -assembly:commons -target:library -version:1.0.0.0 commons-collections-3.2.1.jar


collection蓦然萎缩在地,念是通身内力尽被Ray所吸去,Apache派人等尽皆失色,“我等苦练10短载,内功尽为汝一夕取去”,莫敢上前。

Ray扭转.NET派,试练collection的神功,凭借IKVM.OpenJDK.Core之神器,神功即成,预演如次:


C#代码
一.using System;
2.
三.using org.apache.commons.collections;
四.using org.apache.commons.collections.functors;
5.
六.namespace MyLib
7.{
8. class Program
9. {
10. static void Main(string[] args)
11. {
12. String name = "Tim";
13. Predicate nameJohn = new EqualPredicate( "John" );
14. Predicate nameTim = new EqualPredicate( "Tim" );
15. Predicate instanceString = new InstanceofPredicate(typeof(String) );
16. Predicate instanceDouble = new InstanceofPredicate(typeof(Double));
17. Console.Out.WriteLine( "Is Name John?: " + nameJohn.evaluate( name ) );
18. Console.Out.WriteLine("Is Name Tim?: " + nameTim.evaluate(name));
19. Console.Out.WriteLine( "Is this a String?: " + instanceString.evaluate( name ) );
20. Console.Out.WriteLine( "Is this a Double?: " + instanceDouble.evaluate( name ) );
21.
22. }
23. }
24.}
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 ) );

}
}
}



相较原有神功:

Java代码
一.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 );
8.// Testing all predicates for "Tim"
九.System.out.println( "Is Name John?: " + nameJohn.evaluate( name ) );
十.System.out.println( "Is Name Tim?: " + nameTim.evaluate( name ) );
11.System.out.println( "Is this a String?: " + instanceString.evaluate( name ) );
12.System.out.println( "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 ) );


居然绝无2致。

偌大Java江湖,自此为我.NET所用,哇哈哈哈
本文来源:
我的异常网
Java Exception
Dotnet Exception
Oracle Exception

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值