Questions tagged [lambdaj]

LambdaJ is a library to manipulate a collections without any iterations.

LambdaJ is a library to manipulate a collections without any iterations. It allows to manipulate collections in a pseudo-functional and statically typed way.

The purpose of this library is to alleviate these problems employing some functional programming techniques but without losing the static typing of java. LambdaJ team imposes this last constraint to make refactoring easier and safer and allow the compiler to do its job.

For more information refer this : http://code.google.com/p/lambdaj/

84 questions
46
votes
6 answers

DTO pattern: Best way to copy properties between two objects

In my application's architecture I usually send the object or list of objects from the data access layer to the web layer via the service layer, in which these objects get transformed from a DAO object to a DTO object and vice versa. The web layer…
Tapas Bose
  • 25,780
  • 71
  • 202
  • 317
15
votes
4 answers

Java: how to transform from List to Map without iterating

I have a list of objects that I need to transform to a map where the keys are a function of each element, and the values are lists of another function of each element. Effectively this is grouping the elements by a function of them. For example,…
Kkkev
  • 4,095
  • 4
  • 23
  • 40
12
votes
2 answers

Using lambdaj in android

Does anyone tried to use lambdaj library in android development? It works fine for me when I create a simple small java application, but I can't manage to use it in an android application. UPDATE: I'm adding lambdaj…
Andrey Neverov
  • 1,995
  • 1
  • 11
  • 21
11
votes
2 answers

Application-wide configuration of Lambdaj FinalClassArgumentCreators. Where and how to do it?

We have a problem with configuring lambdaj to work with Joda Time. Since LocalDate is a final class, Lambdaj needs to be initialized like following: (see bug 70) public class LocalDateArgumentCreator implements FinalClassArgumentCreator
RJo
  • 12,543
  • 5
  • 26
  • 63
10
votes
3 answers

Type-safe flattening of nested collections/structures in Java

I would like to flatten arbitrary deeply nested collections/structures of elements of some type T in Java, optimally with only having a live view and not a copied collection; not only handling Collections, but also Iterator, arrays of T of…
DaveFar
  • 6,260
  • 3
  • 39
  • 80
10
votes
3 answers

Lambda expressions of .NET in Java

I recently moved from C# to Java [again]. But I badly miss lambda expressions and things like IEnumerable.Foreach of C#. So I am looking for a lambda expression library in Java. are there better libraries than LambdaJ? Also is clojure directly…
Fakrudeen
  • 5,242
  • 7
  • 38
  • 66
8
votes
2 answers

Typesafe property name for a java bean

I'm looking for alternatives to get a property name in a type safe way. For example, using lambdaj, I can do: propertyName(on(Contract.class).getContractKey()) But this is a bit verbose and the performance is not great. I'm hoping for something…
IttayD
  • 25,561
  • 25
  • 109
  • 173
7
votes
2 answers

From List to Map>: looking for a better implementation

Let me show you my code: Class Foo public class Foo { String code; String value; public Foo(String code, String value) { super(); this.code = code; this.value = value; } // getters/setters } Main method…
user6904265
  • 1,878
  • 1
  • 13
  • 21
7
votes
2 answers

Lambda expressions versus lambdaj

During a Java integration project I did last year I discovered lambdaj and was immediately convinced by its ability to let me produce more readable code faster. I remember reading about lambda expressions coming to 1.8 around that time as well and…
Lilienthal
  • 3,939
  • 9
  • 44
  • 80
7
votes
2 answers

Is there a Java library for defining predicates as SQL-like strings?

Lambdaj (and some other similar libraries) provides a having function which allows me to define predicates like so (example directly from the lambdaj Features page): List oldFriends = filter(having(on(Person.class).getAge(),…
bacar
  • 8,982
  • 11
  • 52
  • 71
6
votes
1 answer

java lambdaj 'variable_name' cannot be resolved to a variable error

I am new to Java 8 features and this may be a stupid question but I am stuck at this point. I am trying to run following code in eclipse but it gives compile time error. import java.util.ArrayList; import java.util.Collection; import…
6
votes
2 answers

Java mechanisms at use in lambdaj closures

Lamdbaj allows the definition of closures in the Java language, various examples can be found here My question is regarding the underlying Java mechanisms at use, for instance, to define the println closure, the following code is used: Closure…
Derek Mortimer
  • 841
  • 1
  • 7
  • 11
6
votes
1 answer

Filtering collections with lambdaj

I have two classes like that: public class Order{ private Integer id; private List positions; ... } public class Position{ private Integer id; private String content; ... } Now, I have a list with orders and want…
Qri
  • 227
  • 3
  • 11
5
votes
1 answer

org.hamcrest.Matchers for matching different properties simultaneously of an Object

I am trying to match two different properties of an Object by org.hamcrest.Matchers. Here it is: List leaveApplyList = Lambda.select( allLeaveApplyList, Matchers.allOf( Lambda.having( …
Tapas Bose
  • 25,780
  • 71
  • 202
  • 317
5
votes
2 answers

LambdaJ forEach set

I want to set value to a field of an object so that it will first get the previous value of that field and append something to it and the set it to that field. In LambdaJ forEach we can do something like…
Tapas Bose
  • 25,780
  • 71
  • 202
  • 317
1
2 3 4 5 6