有什么像LINQ for Java吗? [英] Is there something like LINQ for Java?
问题描述
开始用C#学习LINQ。
特别是LINQ to Objects和LINQ to XML。
我真的很喜欢LINQ的强大功能。
Started to learn LINQ with C#.
Especially LINQ to Objects and LINQ to XML.
I really enjoy the power of LINQ.
我学到了一些名为 JLINQ 的Jscript实现。
此外(如Catbert贴)Scala会有 LINQ
I learned that there is something called JLINQ a Jscript implementation.
Also (as Catbert posted) Scala will have LINQ
你知道LINQ或类似的东西是否会成为Java 7的一部分?
更新:2008年有趣的信息 - LINQ for Java工具
Do you know if LINQ or something similar will be a part of Java 7?
Update: Interesting post from 2008 - LINQ for Java tool
推荐答案
查看 Scala
在Scala中,可以使用与LINQ中基本相同的代码构造,这是一种强大的函数式编程语言,但是类似于Java并在Java平台上运行。 ,虽然在C#或VB中没有特殊的查询语法语法。
In Scala it is possible to use essentially the same code constructs as in LINQ, albeit without special query comprehensions syntax present in C# or VB.
编辑:
以下是Scala查询功能的示例:
Here's an example of Scala's querying capabilities :
// Get all StackOverflow users with more than 20,000 reputation points.
val topUsers = for{
u <- users
if u.reputation > 20000
} yield u;
println ("Users with more than 20,000 reputation:")
for (u <- topUsers) {
println u.name
}
这篇关于有什么像LINQ for Java吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!