Java: Comparing two string arrays and removing elements that exist in both arrays

前端 未结 7 1712
余生分开走
余生分开走 2020-12-14 21:38

This is mainly a performance questions. I have a master list of all users existing in a String array AllUids. I also have a list of all end dated users existing in a String

7条回答
  •  天涯浪人
    2020-12-14 22:03

    Don't use arrays for this, use Collection and the removeAll() method. As for performance: unless you do something idiotic that leads to O(n^2) runtime, just forget about it. It's premature optimization, the useless/harmful kind. "thousands of users" is nothing, unless you're doing it thousands of times each second.

    BTW, PHP "arrays" are in fact hash maps.

提交回复
热议问题