We created a Java interface Enumerable, similar to LINQ.NET's
IEnumerable. IEnumerable is built into C#, and that gives it
advantages: the standard collections implement it, and you can use
any IEnumerable in a foreach loop. We made the Java
Enumerable extend Iterable,
so that it can be used in for-each loops. But the standard
collections still don't implement it. A few methods that take an
IEnumerable in LINQ.NET take an Iterable in LINQ4J.
LINQ.NET's Dictionary interface maps to Map in Java;
hence, the LINQ.NET ToDictionary methods become
LINQ.NET's decimal type changes to BigDecimal. (A little bit unnatural,
since decimal is primitive and BigDecimal is not.)
.NET allows extension methods — static methods that then
become, via compiler magic, a method of any object whose type is the
same as the first parameter of the extension method. In LINQ.NET, the
IQueryable and IEnumerable interfaces have many such methods.
In Java, those methods need to be explicitly added to the interface, and will
need to be implemented by every class that implements that interface.
We can help by implementing the methods as static methods, and by
providing an abstract base class that implements the extension methods
in the interface. Hence AbstractEnumerable and
AbstractQueryable call methods in Extensions.
.NET Func becomes Function0,
on the number of arguments to the function, because Java types cannot be
overloaded based on the number of type parameters.
Function types that accept primitive types in LINQ.NET have become
boxed types in LINQ4J. For example, a predicate function
Func<T, bool> becomes Func1<T, Boolean>.
It would be wrong to infer that the function is allowed to return null.