This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!

Vaibhav Gargs

Ranch Hand
+ Follow
since Sep 08, 2016
Vaibhav likes ...
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Vaibhav Gargs

So, is it safe to say that using Optional also we can't avoid null pointer exceptions. In null handling code, we need to check for not null and in optional we need to check for ifpresent.

Hence, there doesn't seem any difference between the two. Please let me know if I am missing anything.
1 month ago
Prior to Java 8, we used to write the code:

And, using Optional, we write :

In both the cases, we have to put the if conditions, so, what is the advantage of optional actually? There, we used to check if obj is not null and here we call ifPresent method, so,what is the difference?
1 month ago
Why someone will want to persist the data from cache to data store? In general, isn't it other way round, we get the data from data store and add it to cache.
3 months ago
We have to cache some data to improve the performance. The application will be deployed in multiple clusters. Which cache will be better to use here: Redis or Memcache?
3 months ago
Strings are created in String Pool. Would it be possible to see the strings in pool during debug in eclipse?
3 months ago
Hibernate entities should implement the Serializable interface. What is the reason to do so? If we are using plain JDBC, then there is such a restriction?
4 months ago
If we have to prevent singleton objects from serialization, then we have to override readResolve method and thrown an Exception accordingly. I have certain queries:

1. What is the purpose of readResolve method?

2. What is the actual flow?

3. Is it used in any of the serialization/deserialization prcess?

4. Where is its default implementation defined?
4 months ago
Suppose we have the following code:

If I run this code, it still prints "Main". Shouldn't it print Method instead since we are passing the object reference and updating the value at the reference. So, why it is not getting updated?
4 months ago
UUID is Unique Universal Identifier. I would like to understand how is it possible to generate the unique identifier universally? How UUID achieves this?
4 months ago

Campbell Ritchie wrote:It wouildn't work. Do you know any CPUs that don't support whichever instruction that is?

Hi Campbell, I am not sure if any such CPU exists but since these are some special instructions such as CAS etc. which made me think that these instructions will be supported by all CPUs or not?
Dear Stephan, how it will behave if some CPU doesn't support those kind of special instructions set?
What is the difference in Spring Singleton and Java Singleton? I understand that Spring Singleton is 1 instance per spring container per JVM while Java Singleton is 1 instance per JVM.

I am just wondering in Spring MVC application, how can we have more than 1 spring containers?
4 months ago
In the implementation of hashcode methods, I have generally observed that it uses the number 31 in calculations; what could be the reason behind using this number why not other prime number such as 37, 41, 43 etc.
6 months ago
Thank you all for your inputs. But I feel that there will be some impact (though not much significant) on performance if we increase the number of elements; isn't it?
6 months ago
Thank you Ron. But how can we ensure that the hash function distributes elements equally? What are the guidelines to achieve this?
6 months ago