Похожие чаты

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

18 просмотров

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

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

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

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
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
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта