Core Java

Core Java - OOP Concepts, Garbage Collection, Multi-threading, Collections Framework, Java 8 Features, Lambda Functions, Streams.

Difference between ExecutorService submit and execute method

Upasana | June 23, 2022 | 2 min read | 17 views

You should prefer to use submit() method because it gives more flexibility to the programmer in terms of execution control i.e. you can check status of task, cancel a task or get the results of task. Additionally a better exception handling is possible using submit().

Read Article

Given a collection of 1 million integers, all ranging between 1 to 9, sort them in Big O(n) time

Upasana | November 22, 2020 | 2 min read | 669 views | Java Coding Challenges algorithm-datastructures

This is a typical Integer Sorting problem with a constraint that the number range to sort is very limited in spite 1 million total entries. Integer Sorting with limited range is achieved efficiently with Bucket Sorting.

Read Article

CRC32 checksum calculation Java NIO

Upasana | November 21, 2020 | 1 min read | 100 views

Java FileChannel provide much better performance than the BufferedInputStream and RandomAccessFile classes.

Read Article

ConcurrentModificationException in Java

Upasana | November 21, 2020 | 1 min read | 1,287 views | Multithreading and Concurrency

ConcurrentModificationException is raised by fail-fast iterators when the underlying collection is modified structurally during iteration.

Read Article

Count word frequency in Java

Upasana | November 19, 2020 | 2 min read | 107 views

we will calculate word frequency for each word in a given sentence using various approaches - plain java, java 8 streams, parallel streams, etc.

Read Article

Factorial of a large number in Java BigInteger

Upasana | October 18, 2020 | 1 min read | 374 views

Factorial of relatively large numbers can be calculated by storing the resultant in BigInteger instead of a long or double

Read Article

Secure OTP generation in Java

Upasana | October 17, 2020 | 2 min read | 0 views

In this article we will learn how to generate a cryptographically strong OTP in Java using SecureRandom class.

Read Article

Code review checklist for Java developers

Upasana | October 16, 2020 | | 24 views

Code review checklist considering clean code, concurrency, Reusability, Performance, Error Handling, Readability, Code Convention & Consistency and Security.

Read Article

What is purpose of Collections.unmodifiableCollection

Upasana | October 03, 2020 | 1 min read | 70 views | Multithreading and Concurrency

What does Collections.unmodifiableCollection() do? Is it safe to use the collection returned by this method in a multi-threading environment?

Read Article

Java Exception Class Hierarchy

Upasana | September 12, 2020 | 2 min read | 281 views

Throwable sits at the top of Java Exception Class hierarchy. Exception and Error are the two direct subclasses that extends Throwable.

Read Article