tag:blogger.com,1999:blog-8712770457197348465.post1465052219165383490..comments2024-03-29T05:54:46.190-07:00Comments on Javarevisited: How to Implement Linked List in Java with JUnit Test Examplejavin paulhttp://www.blogger.com/profile/15028902221295732276noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-8712770457197348465.post-4025643805208514752016-08-31T19:49:18.560-07:002016-08-31T19:49:18.560-07:00If you try to add one more element in the linkedli...If you try to add one more element in the linkedlist, the above program will not work. there should be some correction in tail().Anonymoushttps://www.blogger.com/profile/12093438039008593871noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-36210157401005897022016-07-22T02:31:23.806-07:002016-07-22T02:31:23.806-07:00This is good linked list implementation but its ju...This is good linked list implementation but its just a singly linked list. I want to implement doubly linked list in Java? Can anyone please guide me how to implement doubly linked list in Java?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-45742627976559325162015-02-11T20:54:47.028-08:002015-02-11T20:54:47.028-08:00Here length() and tail() method can be optimized b...Here length() and tail() method can be optimized by taking length and tail as instance variable. Modify both inside append() method as required so that there would not be any while loop in length() or tail() method to know length or tail node respectively. By this we can reduce time complexity of both methods from O(n) to O(1).Anonymoushttps://www.blogger.com/profile/06188693685179050553noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-79668424261912559812015-02-10T21:39:59.177-08:002015-02-10T21:39:59.177-08:00I think, both kind of approach has its place in un...I think, both kind of approach has its place in unit testing. Yes, encapsulating one mehtod in one test will tell us problem more precisely, but testing multiple method at the same time will allow you to create more scenarios. Lik in this example, if this test fails you will come to know there is some problem with new linked list object and stack trace will guide you to the right place. You can Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-9709575093972373312015-02-09T23:15:05.353-08:002015-02-09T23:15:05.353-08:00There is something that bothers me for writting un...There is something that bothers me for writting unit tests that test multiple public methods at the same time... With a test like in the example, if the method isEmpty() fail, you will know it only when you run your unit test by yourself... <br />If we write a unit test only to test one purpose, the name of the test will be self-explanatory and when you see your build failed in your Continuous brycehttps://www.blogger.com/profile/17106595602514672216noreply@blogger.com