Home » Java » Core Java » Page 30

Core Java

JDK 12 – JEP 325 Switch Expressions

JDK 12 went GA on March 19, 2019, keeping its word on shorter release cycles and frequent releases. The features part of the release can be found here. One of the interesting features for the developers is the “JEP 325 Switch Expressions” which is available as a preview feature. A preview feature as defined here is: A preview language or ...

Read More »

HashSet In Java

Introduction: HashSet in Java implements Set interface i.e. it doesn’t allow duplicates. It is internally backed by a HashMap which works on the principle of hashing.  We can store a null value in a HashSet. Its default capacity is 16 with a load factor of 0.75, where: Load factor = Number of Stored Elements / capacity A Java HashSet is non-synchronized. Also, ...

Read More »

Viewing TLS Configuration with JDK 13

JDK 13 Early Access Build 16 is now available and one of the interesting additions it brings is the ability to have the keytool command-line tool display the current system’s TLS configuration information. This is easier than trying to find supported TLS information in separate documentation and match that information to one’s JDK vendor and version. To see the TLS ...

Read More »

Variance in Java

The other day I came across this post describing what the author sees as pros and cons of Go after 8 months of experience. I mostly agree after working full time with Go for a comparable duration. Despite that preamble, this is a post about Variance in Java, where my goal is to refresh my understanding of what Variance is ...

Read More »

Java Stream: Is a Count Always a Count?

It might appear obvious that counting the elements in aStream takes longer time the more elements there are in the Stream. But actually,Stream::count can sometimes be done in a single operation, no matter how many elements you have. Read this article and learn how. Count Complexity The Stream::count terminal operation counts the number of elements in aStream. The complexity of ...

Read More »

“Callable” vs “Runnable” Tasks in Java Concurrent Programming

When we write multi-threaded applications in Java, we are predisposed to implementing threaded classes by using the “Runnable” interface. Your class has to simply implement this interface and override the run method. For trivial use cases, we can directly start the thread by invoking the “start” method, and the flow of control is delegated to the run method as a ...

Read More »

Top 10 + 1 common mistakes every Java learner makes

It is said, “Your friend will swallow your mistakes, your enemy will present them on a plate”. I am definitely not your enemy, but I want to present you some mistakes, specific to each Java beginner student and I will do it right here on this blogging “plate”. Sure there are only some of them, I collected from CodeGym.cc courses ...

Read More »