我有两个 vavr 列表:
List<Object> list1 = List.of("one", "two", "three", "for");
List<Object> list2 = List.of("one", "two", List.of("three", "for"));
如何将 转换list2为等于list1?
编辑
我试图解释更多我想要达到的目标:
System.out.println("list1: " + list1);
System.out.println("list2: " + list2);
输出:
list1: List(one, two, three, for)
list2: List(one, two, List(three, for))
我想展平 中的所有内部列表list2,因此展平的列表应等于list1:
System.out.println("flattened: " + flattened);
System.out.println(list1.equals(flattened));
应该返回:
flattened: List(one, two, three, for)
true
江户川乱折腾
拉丁的传说
相关分类