Arun Singh Raaj

Ranch Hand
+ Follow
since Jan 30, 2017
Cows and Likes
Cows
Total received
2
In last 30 days
0
Total given
0
Likes
Total received
4
Received in last 30 days
0
Total given
119
Given in last 30 days
3
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Arun Singh Raaj

If developers are using postman to test the rest ws then the real controller is going to accept the request that further passes the request to Service and Data Layer. Then how is it called a unit test? Are developers responsible for performing such integration tests or it's job of the testers?

What I thought developer's job is, using MockMvc to create the HTTP calls and mock service classes within the test class itself and perform the unit testing of controllers.

Please shed some light on it.
Thanks in advance.
6 days ago
Hi, it's really confusing to understand whether a real HTTP request is sent to the controller or test-controller in case of using spring's MockMVC instance while testing the Controller classes in a java based web application. Please share your experience.
Thanks.
1 week ago

Campbell Ritchie wrote:Please remind yourself of that old discussion first. I thought we had answered all your questions there.

Yes I do remember and I'm grateful to you all.

As for a HashMap, how do you know that it uses trees at all?

Yes, RBT isn't mentioned in java-docs of HashMap but wiki page of RBT and implementation page of HashMap given by Josh Bloch (I don't know how official this page is) do talk about it.

If HashMap really uses RBT to store entries in a bucket then the number of entries referenced to a single bucket are sorted, that's the reason of using RBT over linked-list so that search operation is improved from O(n) to O(log n). Isn't it?
3 weeks ago
Red black trees always store elements in sorted order so TreeMap uses the RBT to store entries in buckets. HashMap too uses RBT then why HashMap isn't sorted?

Thanks.
3 weeks ago
When you import existing project in intelliJ, it doesn't create a file system in workspace directory, instead it just creates an .idea folder having some xml files.
In Eclipse IDE when you import existing spring boot maven project then it copies the file system into workspace.
Please let me know how to enable it in intelliJ.
Thanks.
3 weeks ago
Do developers not use Second-level cache of hibernate?
Hi, I read in tutorials that the caching works only for session methods ie get(), load() plus HQL queries which do find by IDs.

I want to know that queries that retrieve all records from db like "select * from employee", the results of such queries are not cached?
If it can be cached then how?

Thanks.
In case of an HTML form, you can bind the form-fields data to List<Employee> at Controller :
but how to bind employee data using postman? It throws exception when you POST JSON data in postman, it doesn't receive List of Employee at controller. Please help to fix it.
Thanks.
1 month ago

Campbell Ritchie wrote:Note that previous and next fields in the nodes are accessible because they are private fields in nested classes. As you can see, the linked list has nodes which can be accessed from each other.

Yes, I get it!
It's easy but I took much time to understand.
LinkedHashMap.Entry has two additional fields:
(package private) LinkedHashMap.Entry<K,V> after
(package private) LinkedHashMap.Entry<K,V> before
These two fields record the insertion order. The picture makes it more clear.
1 month ago
Thanks for the info.

Campbell Ritchie wrote:This is how an array list works, grossly simplified. This is similar to the actual implementation, but not exactly the same.

I get it!

I should've asked you about only LinkedList and HashMap. As I've read somewhere, the linked-list of nodes in HashMap (Java 8)is converted into Red-black tree when it exceeds 8 elements so it still does have linked-list.
Anyway, I want to know in context of Java 7. How does insertion order is preserved in LinkedList and why it couldn't preserve in HashMap. It would be a great help if you respond. Thanks.
1 month ago
I searched but could not understand what implementation of linked-list data-structure makes LinkedList preserve insertion order and why it is not the same for HashMap despite HashMap uses linked-list data structure for nodes.

Thanks in advance.
1 month ago
Hi, if ArrayList/LinkedList have 10 as default size then why does it throw IndexOutOfBoundsException when you insert some value at given index in an empty List:
1 month ago
Hi, what collection would you use to bundle some 100 Employee records that you retrieved from database and have to pass them to the user interface?
Where do developers perform the sorting of those records usually, at backend itself or at UI? If sorting is performed at backend then what collection is better to have in this case?

Thanks.
1 month ago