Похожие чаты

So basically I pass the map and an element to

a newly created UniqueItemCondition class for every element in a big list
would it result in bad performance?
I'm not sure it should - since java doesn't create copies of the set, but who knows..

2 ответов

15 просмотров

Short answer: no, expected performance. No copies made by Java, passed by reference always. Some thoughts about what you're doing: 1. I see that you're only beginning it. The best thing you can do is to get any job where you can work with senior devs, and be guided in your learning. Sitting in vacuum and trying to learn on your own won't take you far. 2. Probably, what you assess as "very big" may be not that at all for the system, and actually depends on jvm params more than on your feelings. Such assumptions most often are very harmful in development, because you'll probably get into "premature optimization" (google that, it's a regular expression in software dev) 3. That separate class for "unique..." is something that makes my eyes bleed. Simple: if (!set.contains(str)) { is 10000 times more readable for Java devs and should be used there. There's no any benefit of seperating that in a class in this particular case. If you want to abstract away that condition, you do it in a wrong way, you should google for "strategy design pattern". 4. I don't see why you're mixing up lists and sets. Looks like you don't need lists. If you were working with sets only, it would be much simpler and clear 5. All that hassle may be simply written like public List<String> doSomething() { List<String> bigList = getBigList(); bigList.removeAll(inputSet); return bigList; } But I suggest to use better domain specific naming like: private Set<String> knownWords = loadKnownWords(); public List<String> findNewWords() { List<String> newWords = readAllWords(); newWords.removeAll(knownWords); return newWords; }

Even explained his/her situation

Похожие вопросы

Обсуждают сегодня

лучше скажите, причём тут паскаль?
Alexey Kulakov
36
@marycamacho @NATHANLENAE @popachubby It was said that HOT will be used for hosting payments. But HOT is ERC20 based. So slow and high paying. The ERC network does not seem ve...
Aragorn
14
Добрый вечер. Хочу чтобы у меня в классе поле было функцией, которая возвращает строку. Делаю так: interface ... TGetOutPath = function : String of object; ... protec...
Kirill Filippenok
12
Ready for some fun AND a chance to win TKO Tokens? Join us for exciting minigames in our Telegram group! 🕒 Don’t miss out—games start on today 25 October 2024, at 8 PM! Ge...
Milkyway | Tokocrypto
255
Bitcoin will probably halt around here somewhere to let alts push a bit?
Neo Smitty
16
Another way to think about it is like this: let's say we sell $100m of FXB2029 and another $100m of FXB2055 and we buy $200m of ETH with it. Do you think that ETH price will b...
Sam Kazemian ¤⛓️¤
20
Это может быть все-таки не флудвейт? у меня ботфазер принимает изменения и отображает даже что они изменились, на видео видно что он прислал якобы уже измененное описание, н...
OVERLINK
13
Say them all. Bitcoin > $91000 means there is no more altcoin. Institutions will buy only Bitcoin. But for a regular human, Bitcoin is a risky asset since it can be easily b...
Rr3ttt5
5
Hello guys! With whom i can talk about nodes?
Moon
17
I just don't understand why they're not responding again... this is a page that shouldn't be publicly available right now and did devops make a mistake by not protecting it wi...
CryptoBoy1007
11
Карта сайта