# Which is faster? ConcurrentSkipListSet vs TreeSet+synchronized

DevFeed: [Which is faster? ConcurrentSkipListSet vs TreeSet+synchronized](<https://devfeed.tech/articles/which-is-faster-concurrentskiplistset-vs-treeset-synchronized-29053.md>)

Original publisher: [Read original article](<https://dmitrysamoylenko.com/2020/10/05/concurrent_skip_list_set.html>)

Author: Dmitry Samoylenko

Published: 2020-10-05T00:00:00Z

Content type: comparison

Language: en

Sources: [Dmitry Samoylenko - Android Developer Blog](<https://devfeed.tech/sources/dmitry-samoylenko-android-developer-blog.md>)

Topics: [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [Java](<https://devfeed.tech/topics/java.md>), [Concurrent Programming](<https://devfeed.tech/topics/concurrent-programming.md>), [Benchmark](<https://devfeed.tech/topics/benchmark.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [code](<https://devfeed.tech/tags/code.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [java](<https://devfeed.tech/tags/java.md>), [performance](<https://devfeed.tech/tags/performance.md>), [synchronization](<https://devfeed.tech/tags/synchronization.md>)

## AI overview

This comparison examines manual synchronization with TreeSet versus ConcurrentSkipListSet for collecting and sorting data from asynchronous requests. In the described use case, TreeSet with synchronization was nearly twice as fast, while the broader choice depends on the workload and number of concurrent events.

## Source excerpt

What's the difference Those two collections are all sorted and very useful when you need to maintain some order in dynamically filled data. However, when concurrency takes place there is a gotcha. We have a choice: use manual synchronization or use ConcurrentSkipListSet from java.concurrent package.