<p><b>@ManfredKarrer</b> commented on this pull request.</p>
<hr>
<p>In <a href="https://github.com/bisq-network/bisq/pull/2361#discussion_r253316378">common/src/main/java/bisq/common/util/PermutationUtil.java</a>:</p>
<pre style='color:#555'>> + /**
+ * Returns a list of all possible permutations of a give sorted list ignoring duplicates.
+ * E.g. List [A,B,C] results in this list of permutations: [[A], [B], [A,B], [C], [A,C], [B,C], [A,B,C]]
+ * Number of variations and iterations grows with 2^n - 1 where n is the number of items in the list.
+ * With 20 items we reach about 1 million iterations and it takes about 0.5 sec.
+ * To avoid performance issues we added the maxIterations parameter to stop once the number of iterations has
+ * reached the maxIterations and return in such a case the list of permutations we have been able to create.
+ * Depending on the type of object which is stored in the list the memory usage should to be considered as well for
+ * choosing the right maxIterations value.
+ *
+ * @param list List from which we create permutations
+ * @param maxIterations Max. number of iterations including inner iterations
+ * @param <T> Type of list items
+ * @return List of possible permutations of the original list
+ */
+ public static <T> List<List<T>> findAllPermutations(List<T> list, int maxIterations) {
</pre>
<p>Yes agree. Not trivial though to optimize it in that direction...</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/bisq-network/bisq/pull/2361#discussion_r253316378">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AkpZtlpfSQEgjKA3enS64c3rs1rbjgBHks5vJz2rgaJpZM4agKwq">mute the thread</a>.<img src="https://github.com/notifications/beacon/AkpZtvEfnZeed44htgsrn_5L4nufEnDgks5vJz2rgaJpZM4agKwq.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/bisq-network/bisq","title":"bisq-network/bisq","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/bisq-network/bisq"}},"updates":{"snippets":[{"icon":"PERSON","message":"@ManfredKarrer commented on #2361"}],"action":{"name":"View Pull Request","url":"https://github.com/bisq-network/bisq/pull/2361#discussion_r253316378"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/bisq-network/bisq/pull/2361#discussion_r253316378",
"url": "https://github.com/bisq-network/bisq/pull/2361#discussion_r253316378",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>