W
W
Wan-Derer2020-09-05 22:03:04
Java
Wan-Derer, 2020-09-05 22:03:04

Java, which is faster: primitives or collections?

There was a small dispute regarding the speed of the algorithm.
Here: https://www.youtube.com/watch?v=pwG_B0tEj9M&lc=Ugz...
Task: to determine if there are duplicate elements in the array passed to the method.
I decided using set , there are 2 code options in the comments. And he said that in this particular case, such a solution would be slower than manual enumeration of int.
The lady opposes me, arguing that this method is just the fastest. But we speak different languages. She brings down terms from books that are incomprehensible to me (because I have not yet dealt with formal complexity), and I try to explain / understand "on my fingers".
What do you think? If possible, "on the fingers" :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2020-09-05
@sergey-gornostaev

I'm not going to watch 46 minutes of video to understand exactly what I'm talking about, but based on the title of the question, I can say that comparing collections with primitives is like comparing soft with warm.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question