I have two lists of objects; List<X> and List<Y>. X and Y are ojects that look like:
public class X {
String a;
String b;
String v;
String w;
String m;
String n;
}
public class Y {
String a;
String b;
List<A> aList;
}
public class A {
String v;
String w;
List<B> bList;
}
public class B {
String m;
String n;
}
How transform List<X> into List<Y> based on a rule:
Some fields' values must be equal.
For example:
In List<Y>, for one object Y, field a's value must equal.
In Y's field List<A>, for one object A, field w's value must equal.
In A's field List<B>, for one object B, field m's value must equal and so on.
Guava has this method, Lists#transform, but I don't know how to transform.
Or any other way?