Java

Using Java lambdas as method parameters

Nothing new, but because I needed a neat list of what kind of lambda I can pass as a parameter for a method, here it is: Class to useinput paramsreturn valuenoteRunnablerun()()Supplierget()xCallablecall()x throws exceptionConsumeraccept(x)()BiConsumeraccept(x,y)()Functionapply(x)yinput/return types can be differentBiFunctionapply(x,y)zinput/return types can be differentPredicatetest(x)booleanUnaryOperatorapply(x1)x2input/return types are the sameBinaryOperatorapply(x1,x2)x3input/return types are the same Code example: public void someMethod(Function<String, Integer>… Continue reading Using Java lambdas as method parameters

Java

Learn dApp coding by writing a Blockchain Trading Bot – Part 2 : Trade cryptocurrencies.

This is the follow-up of Learn dApp coding by writing a Blockchain Trading Bot - Part 1. If you haven't, you should read it first. Now that we know how to connect to our wallet, we are going to trade tokens. Tokens are instances of cryptocurrencies. Smart Contracts A blockchain allows you to record transactions.… Continue reading Learn dApp coding by writing a Blockchain Trading Bot – Part 2 : Trade cryptocurrencies.

Java

Learn dApp coding by writing a Blockchain Trading Bot – Part 1 : Connect to your Wallet

When trying to learn coding on blockchains, you usually find tutorials using theoretical smart contracts. I'll write a series of posts here to tackle a practical use-case : Making money trading tokens. The goal will be to write a trading bot dApp, in javascript, using ethers.js and node.js. A dApp (Decentralized Application) is an application… Continue reading Learn dApp coding by writing a Blockchain Trading Bot – Part 1 : Connect to your Wallet

Java, Terracotta

Terracotta toolkit

The Terracotta Toolkit is an API that provides you many functionalities in a clustered manner. E.g., you can get a Clustered ReadWrite Lock, so you can do synchronization between different applications running on different machines/JVMs. In 3.7, you get the Toolkit like this: ClusteringToolkit toolkit = new TerracottaClient("localhost:9510").getToolkit(); In 4.0, you get the Toolkit like… Continue reading Terracotta toolkit