What is the fastest Java collection of a lot of DTO?

I am returning a large number of collections from a DTO object, and would like to know if anyone can point me in the right direction. Any type of collection is fine, but I don’t know which one is best for returning a large number Object tasks.

I know this can be changed depending on threads etc., but I am looking for at least general guidance and benchmarks. Also, I need to maintain a standard Java collection (no third-party libraries).

As indisputably said: if you need a simple collection, then ArrayList should perform well , Because it is based on an array, it is fast to use the system function according to the definition.

If you set the initial capacity to a higher value (don’t know what you call a large number), then it will be more Fast, because it reduces the number of incremental reallocations.

Any other collection has some kind of overhead, such as finding a hash code or synchronization.

< p>I’m returning a large number of collections from DTO objects and want to know if anyone can point me in the right direction. Any type of collection will do, but I don’t know which one is best for the task of returning a large number of objects.

I know this can be changed based on threads etc., but I am looking for at least general guidance and benchmarks. Also, I need to maintain a standard Java collection (no third-party libraries).

< p>

As indisputable: If you need a simple collection, then ArrayList should perform well, because it is based on an array and it is fast to use system functions by definition.

If you set the initial capacity to a higher value (don’t know what you call a large number), then it will be faster because it will reduce the number of incremental reallocations.

Any Other collections have some kind of overhead, such as finding a hash code or synchronization.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2761 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.