3 ms·
Hello, thank you for writing the library. On my context it is useful for downloading large files without depending on a single point of failure or fixed locati
by nunobrito 9y ago
Hello, thank you for writing the library.
On my context it is useful for downloading large files without depending on a single point of failure or fixed location.
Have a question in regards to the example syntax:
client.startAsync(state -> {
if (state.getPiecesRemaining() == 0) {
client.stop();
}
}, 1000).join();
This is a feature from newer Java syntax that I'm not yet familiar enough with lambdas to understand in full what is happening.
Perhaps I can ask for an example that replaces the "->" into the older Java syntax? I know this would likely come at the cost of a few extra lines, it would certainly ease a lot for many developers looking at the example. Many thanks.
- train_robber 9y agoIn the older syntax, something like this: client.startAsync(new Consumer<TorrentSessionState> { void accept(TorrentSessionState state) { if (state.getPiecesRemaining() == 0) { client.stop(); } } }, 1000).join();
- nunobrito 9y agoThank you. Really useful.
- tokenizerrr 9y agoJust read the Java 8 docs.
- nunobrito 9y agoSome developers work on large code bases where adding lambdas or fresh new syntax features isn't really seen as an advantage for the rest of the teams, most often explicitly restricted. I can only thank those who wrote such obfuscated code in previous years, that eventually forced everyone else afterwards to write code as simple and clear as reasonably possible. That's the reason why I've asked for the simplified code, Might as well save the time for other developers on similar situation.
- tokenizerrr 9y agoNo, the simplified code is the Java 8 code. You are just clinging to the archaic syntax that you are used to. Of course you can choose to shoot yourself in the foot and just stick with Java 6, but don't try to force others to make the same mistake.
- nunobrito 9y ago> don't try to force others to make the same mistake Seems you prefer to put everyone on the same bag and speak for them too.