Java by example

Below is a list of Java examples helping you to solve common development issues.


Core Java examples:

  1. Java 8 forEach examples
  2. Java 8 Comparator examples
  3. Java 8 Stream map examples
  4. Java 8 Stream filter examples
  5. Java 8 Stream flatMap examples
  6. Java 8 How to sort a Map
  7. Java 8 Stream groupingBy examples
  8. Java 9 Collections Factory method
  9. Java 9 JShell Basics
  10. How to convert a string to an integer
  11. How to convert a byte array to a string
  12. How to convert an InputStream to String in Java
  13. Generate a Random number in Java
  14. How to sort an Array in Java
  15. How to get your server IP address in Java
  16. Convert a string to a list split by new line

HttpClient examples:

  1. HttpClient PUT request example
  2. HttpClient POST request example
  3. HttpClient GET request example

File processing examples:

  1. How to create a file in Java
  2. How to read a file in Java
  3. How to write to a file in Java

JSON processing examples:

  1. How to parse a JSON file using GSON
  2. How to write JSON object to File in Java
  3. How to convert Java object to JSON using GSON
  4. How to convert JSON string to a Java object using GSON
  5. How to parse a JSON array into a List using GSON
  6. Convert JSON to a Map using Jackson
  7. Convert a Java map to JSON using Jackson
  8. Convert a List to JSON array using Jackson
  9. Java object to JSON using Jackson
  10. Parse JSON string to a Java object using Jackson
  11. How to parse JSON using Jackson

Application configuration examples:

  1. Logback Configuration Examples
  2. Logback logging with MDC
  3. How to read a properties file in Java


More examples to follow.


  1. Java 8 Documentation

Leave a Reply