Disposable

A Disposable is any object that can be “disposed of” to relinquish its resources or cancel its task. The disposable interface is adopted by several objects returned from standard API methods. To conform to the disposable interface, an object needs only to implement a dispose() method.

The Disposable interface is not subclassable.

Class Methods

isDisposable(object)

Returns true if the argument provided is a disposable object which responds to dispose().

Methods

dispose()

Relinquishes the object’s resources, which may include stopping a listener, cancelling a task, or some other “event”. Calling dispose() multiple times on an object is allowed, but will not affect the object after the first call.