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

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -