Quantcast
Viewing latest article 24
Browse Latest Browse All 73

Autoclose Lock

I was just wondering if there is a difference between the classic:
	lock.lock();try { //I have the lock!
	}  finally {
		lock.unlock();
	} 

And the Autocloseable version:

	lock.lock();try (AutoCloseable auto = lock::unlock) { //I have the lock!
	} 


Viewing latest article 24
Browse Latest Browse All 73

Trending Articles