Похожие чаты

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

7 просмотров

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

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

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

Есть какой-нибудь для Delphi/FPC T*Compression(Decompression)Stream на базе LZ4/Zstd/любой другой быстрый(и хорошо сжимающий) алгоритм А ещё лучше в pure pascal А ещё лучше од...
notme
48
Ясн. Но я всеравно к кедам отношусь с опасением. Чисто субьективное кедосозерцание. Что касаемо "восторга изяшности кед" так и не вкурил, хотя много слышал, пока не поставил с...
Артем Записной
30
А чем вам питонисты не угодили?😂
.
79
type TObj = object procedure Init; virtual; end; TObj1 = object(TObj) procedure Init; override; end; procedure TObj1.Init; begin inherited; end; procedur...
Alexander 👋
29
Hey guys, did you see the new announcement about $Fun? 🔥
Filip Murphy
55
Такой вопросец - есть функция function MySuperDuperConcat(const a: array of AnsiString): AnsiString; Как мне в её теле сделать вот так? Result:=Concat(a); А не грустный вариан...
notme
15
[c8] what's the best looking best ux mobile wallet in crypto?
DiscordBridge
13
They keep hyping $FUN but where's the progress? 🙄
Noah Noure
23
Btw guys very stupid question but i haven't researchd so js asking you pros . Can ltc be traced too? Literally point to pint to the user? And getting the banks blocked ? Exch...
20
Can I deposit from Bingx-exchange to wazirx? Any problem? Admin
Crypto Alt Trader
16
Карта сайта