Java Equivalent of C# async/await? -
i normal c# developer develop application in java. looking there java equivalent of c# async/await? in simple words java equivalent of,
async task<int> accessthewebasync() { httpclient client = new httpclient(); var urlcontents = await client.getstringasync("http://msdn.microsoft.com"); return urlcontents.length; }
no, there isn't equivalent of async/await in java - or in c# before v5.
it's complex language feature build state machine behind scenes.
there's relatively little language support asynchrony/concurrency in java, java.util.concurrent package contains lot of useful classes around this. (not quite equivalent task parallel library, closest approximation it.)
Comments
Post a Comment