Skip to content
sneppets

sneppets

  • Privacy
sneppets-java8

Format LocalDate to String or int with Month and Day in double digit

January 30, 2020February 12, 2020 Editorial StaffLeave a Comment on Format LocalDate to String or int with Month and Day in double digit

Let’s say you wanted to format LocalDate like yyyyMMdd with date’s month and day values in double digit to String or int, then follow this tutorial.

Java Calendar, Date, java, LocalDate
sneppets-java8

Check if Element exists in a Collection using Lambda Expressions

January 29, 2020February 12, 2020 Editorial StaffLeave a Comment on Check if Element exists in a Collection using Lambda Expressions

If you wanted to check whether element exists in a collection or not using specific id or name, the better approach is to use anyMatch() method of Stream interface of Lambda Expressions.

Java java, java-8, lambda

How to build maven project without version

December 15, 2019February 12, 2020 Editorial StaffLeave a Comment on How to build maven project without version

If you wanted to build maven project without the version details mentioned in your pom file, then you need to follow the below instructions.

Java java, maven

JSONException : A JSONObject text must begin with ‘{‘ at 1 [character 2 line 1]

December 14, 2019February 12, 2020 Editorial StaffLeave a Comment on JSONException : A JSONObject text must begin with ‘{‘ at 1 [character 2 line 1]

Are you getting error “A JSONObject text must begin with ‘{‘ at 1 [character 2 line 1]” while parsing JSON response. First you need to check whether JSON string/response is valid or invalid JSON.

Java java, JsonObject, org.json.JSONObject

Java – Check if object is null using Objects class static utility methods

December 10, 2019February 12, 2020 Editorial StaffLeave a Comment on Java – Check if object is null using Objects class static utility methods

Checking if object is null is a common problem in Java. To check that you can check if object itself is null or you can also use static utility methods of java.util.Objects class for operating on objects.

Java java, Object, Objects

Posts navigation

Older posts
Newer posts
Copyright © 2018 Sneppets. All Rights Reserved