Skip to content

Tag: java

Try-finally with lock when no exception is thrown

In the java manual it says that it is recommended to use try-finally when using lock() and unlock(), but this is also necessary when an exception is never thrown in the try block? for example: Answer Adding it always is a reasonable advice: For a beginner, because they may not be aware of all the ways excepti…

How to Get data from nested LinkedHashMap

How to get the “test” data from this linkedHashMap response.get(“url”) = null response.get(“data.images.original.url”) = null response.get(“data”).get(“images”).get(“original”).get(“url”) toString(); result{data={images={origi…

How to thread-safe update loadingcache value guava map

For the test, in the addCache method, I created and added a map. The card has a key “a” and a value “1111”. And key “b” for LoadingCache. Next, I want to update the value “1111” to the value “2222”. To do this, I pass all the necessary parameters fro…

https proxy using okhttp3

I am using okhttp3 and trying to see how do I pass userId & pswd to authenticate with proxy server that accepts only HTTPS protocol. I already saw exmaple over SO & on other sites(link below) but they don’t have HTTPS protocol. https://botproxy.net/docs/how-to/okhttpclient-proxy-authentication-h…