Author: Arpit Mandliya
- 23 March
Read File Into String in Python
1. Introduction to the Problem Statement When working with file operations in Python, a common requirement is to read the contents of a file into a string. This can be essential for various applications, such as data processing, text analysis, or just simple file manipulation. For instance, if we have a file named example.txt with […]
- 23 March
Get current timestamp in java
In this post, we will see how to get current timestamp in java. There are multiple ways to get current timestamp in java. Using Java 8’s Instant class There are three ways to get timestamp using Java 8‘s java.time.Instant class. Using Instant.now() [crayon-678911c999f1d819312692/] Using date.toInstant() [crayon-678911c999f24079902191/] Using timestamp.toInstant() [crayon-678911c999f26839079319/] Here is complete example for get […]
- 22 March
XOR operator in java
In this tutorial, we will see about XOR operator in java. XOR operator or exclusive OR takes two boolean operands and returns true if two boolean operands are different. XOR operator can be used when both the boolean conditions can’t be true simultaneously. Here is truth table for XOR operator. Let’s say you have Person […]
- 22 March
[Fixed] insert dimensions to complete referencetype
In this post, we will see about error insert dimensions to complete referencetype. You will get this error when you are trying to pass primitive objects into generic type declaration but generic always expect a Wrapper class in java. For example: Let’s say you have the below class named InsertDimensionlMain.java. [crayon-678911c99a15a145593978/] Above code won’t compile, […]
- 21 March
Java isNull method
In this post, we will about Objects class’s isNull method. Objects’s isNull() method is used to check if object is null or not. java.util.Objects class was introduced in java 7. Here is simple example for Object's isNull method. [crayon-678911c99a223121501191/] Output: Is str1 null: false Is str2 null: true Let’s look at source code Object’s isNull() […]
- 21 March
Install Maven on Mac
In this post, we will see how to install maven on Mac. If you are using the latest MacOSX, maven may be built-in and can be found at /usr/share/maven. Execute below command on terminal to see if you have maven installed. $mvn –version -bash: mvn: command not found If you get -bash: mvn: command not […]
- 21 March
Run single test in maven
In this post, we will see how to run single test in maven. If you want to execute all the Junit testcases in maven. You can run it below command. Run all testcase mvn test You need to go to the project location which contains pom.xml and execute above command. Run all testcases from a […]
- 21 March
Skip tests in maven
In this tutorial, we will see how to skip tests in maven. It is not a good idea to skip junit tests while building project in maven but sometimes, you may need to skip it for building new code and want to test it quickly. For example: In a large project, where you have more […]
- 17 March
PriorityQueue in Java 8
In this post, we will see about Java 8 PriorityQueue. When the objects are supposed to be processed on the basis of their priority, in that scenario we use PriorityQueue. It’s a special type of queue (also, unbound queues) where the elements can be ordered either as per their natural ordering or based on a […]