Quantcast
Channel: User Thomas - Stack Overflow
Viewing all articles
Browse latest Browse all 39

How to make a delayed non-blocking function call

$
0
0

I want to call the add function of an HashSet with some delay, but without blocking the current thread. Is there an easy solution to achieve something like this:

Utils.sleep(1000, myHashSet.add(foo)); //added after 1 second//code here runs immediately without delay...

Viewing all articles
Browse latest Browse all 39

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>