Похожие чаты

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 ответов

16 просмотров

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

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

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

This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
есть ПО, которое лежит папкой, по сути и не инсталится, а просто запускается. Надо раскидать по машинам в домене. Я так понял, что прям настройками GPO, копировать я смогу тол...
Dmitriy
8
any reference of this implementation?
BitBuddha
29
Чёт не понял, я ж правильной функцией воспользовался чтобы вывести отладочную информацию? но что-то она не ловится
notme
18
Привет)) уже кажется эту тему перемусолили, но вот я так и не понял. Я сейчас сижу на 27дюймов 2к мониторе. На Актуальной макоси, если я куплю 27д 4к монитор: - будет ли изобр...
Vladislav Piskunov
16
Добрый день! Скажите пожалуйста, а какие программы вы бы рекомендовали написать для того, чтобы научиться управлять памятью? Можно написать динамический массив, можно связный ...
Филипп
7
Also, why can’t the community have a vote/ say when it comes to initiatives like buybacks. Isn’t the point of crypto decentralisation? Don’t we deserve input as long term supp...
👨🏽‍🦰
13
Карта сайта