How to read and write a CSV file using Apache Commons CSV
gradle test
A quick review to the java.util.Date
API in Java 8
javac BetweenDays.java
java BetweenDays
javac DateOperations.java
java DateOperations
How to read an Excel file using Apache POI
gradle test
How to read filtered rows in Excel file using Apache POI
gradle test
Hello World using AWS Lambda
gradle buildJar
Since Java 7 we can copy files in a easy way
javac FileCopier.java
java FileCopier
Generic configuration interface which enables a Java application to read configuration data
gradle buildJar
java -jar properties-apache-commons-all-0.0.1.jar
Read and copy files using AWS Lambda
gradle buildZip
aws lambda invoke \
--invocation-type Event \
--function-name s3-aws-lambda \
--region us-west-1 \
--payload file://inputfile.txt \
outputfile.txt
In your computer's home directory: ${home}
, create a directory called: .mailbox-reader
then inside create a file called application.properties
with this content
username=user@gmail.com
password=secret
pop3.server=pop.gmail.com
pop3.port=995
imap.server=imap.gmail.com
imap.port=993
ews.username=user@outlook.com
ews.password=secret
ews.server=https://exchange/EWS/Exchange.asmx
ews.protocol=https://
gradle build
java -jar mailbox-reader-0.0.1-SNAPSHOT.jar
- This approach is using Gmail account with IMAP enabled (Settings > Forwarding and POP/IMAP)
- Using Exchange Web Services EWS Java API
- Read body email usgin text/plain as ContentType
- Read body email using multipart/mixed as ContenType
- http://josdem.io/techtalk/camel/mailbox_reader/
- http://josdem.io/techtalk/java/mailbox_reader_pop3/
- http://josdem.io/techtalk/java/mailbox_reader_imap/
- http://josdem.io/techtalk/java/mailbox_reader_exchange/
- http://josdem.io/techtalk/spring/spring_unit_testing_spock/
- http://josdem.io/techtalk/spring/spring_boot/
- http://josdem.io/techtalk/spring/spring_gradle/
Stream interface is defined in java.util.stream package
. In Java 8, collections will start having methods that return Stream. Streams support Aggregate Operations. The common aggregate operations are filter, map, reduce, find, match and sort.
javac ${JAVA_PROGRAM}.java
java -ea ${JAVA_PROGRAM}
A stream represents a sequence of elements and supports different operations to perform calculations in those elements, here we review the filters:
javac ${JAVA_PROGRAM}.java
java -ea ${JAVA_PROGRAM}
How use collectors over streams to group by, concatenate, map and list.
javac ${JAVA_PROGRAM}.java
java -ea ${JAVA_PROGRAM}
How use Executors, Callable and Futures
javac ${JAVA_PROGRAM}.java
java ${JAVA_PROGRAM}
How we can use Generics in Java.
To run the code:
javac ${JAVA_PROGRAM}.java
java -ea ${JAVA_PROGRAM}
To test the code:
gradle test
A functional interface in Java is any with @FunctionalInterface annotation and with SAM(Single Abstract Method). It was introduced to facilitate Lambda expressions. Since a lambda function can only provide the implementation for one method, it is mandatory for the functional interfaces to have only one abstract method.
javac ConsumerExample.java
java ConsumerExample
gradle test
mvn test
Since Java 8 we have Lambda expressions which is a function defined under some interface contract and the main purpose is to implement functional programming in Java.
gradle test
mvn test
Once called a Billion-dollar mistake. NullPointerException is by far one of the most frequent exceptions in Java and since version 8 we can use it as a way to avoid this exception. Optional is a container that can has a value or not.
gradle test