In scala,I am trying to sort the below sequence of sequence,Seq(Seq(2,3,4),Seq(1),Seq(1,2),2,3),Seq(2,4,5),Seq(3,6),5))
.sortWith((a,b)=>{
(a zip b).filterNot(x => (x._1==x._2 || x._1 > x._2)).size > b.size
})
Output required:
<br/>1
<br/>1,2
<br/>1,3
<br/>1,4
<br/>2,3
<br/>2,5
<br/>2,5
<br/>3,4
<br/>3,6
The pattern that I am looking for is similar to the following,<br/>1
<br/>1,5,6,7
<br/>3
<br/>3,5
直接比较2个序列,但这很具有挑战性。
请帮助我解决该情况。