I have two classes
public class User {
private int _Id;
private String _FirstName;
private String _LastName;}
and
public class Card {
private int _Id;
private int _UserId;
private String _Serial;}
I have Array of User[] and Card[]. And i want to create
HashMap<String, User> where User._Id == Card._UserId and string (in HashMap) is _Serial from Cards... I think i can use lambdaj but i don't know how..
Unfortunately I don't know lambdaj, so I can not offer a solution using lambdaj. But I think one can solve the problem reasonably elegant and effectively with plain Java in two steps.
I didn't test the code but I am very optimistic that it works ;-)
As I don't like Arrays, I used Lists of Users and Cards as input.
Hope this helps!
}
If one like it more condensed, one can do it like this:
}