Writings.

  1. Scope in switch expression

    Switch expression is not very often used in everyday practice of a Java developer. So, I suppose, knowledge about this construction isn't so deep as for 'if-else' or 'for'. At least, mine... :) I have faced one interesting case and want to share it with you. Let's take a look oat…

    java case swtich break scope

  2. Mocking of callback function via Mockito

    I suppose, the first case every developer learn in Mockito is mocking methods with a return value. Construction when().thenReturn() covers 80% of all case in a code I suppose. Next thing what developers learn in Mockito is mocking of void method. doAnswer().when() usually used for this purpose. But…

    java mockito tests

  3. Date and Size rolling in log4j

    Currently, I am working on a project, where we have faced the problem of the huge size of daily logs. We have some environment, which exists on the same shared file system, so if logs on some environment will consume free disk space, it will cause crashing of other environments.…

    java log4j log log-rolling date-rolling size-rolling

  4. Java interview for developer. Collections. Part 3 - Maps and Trees

    This is the last part of java interview questions for collections. Here is part one and two. 13. In what case you could "lost" element in HashMap? This question is tricky, it's simple to understand, but it is not so transparent at the first glance. Let's imagine a…

    java collections map hash map treemap set treeset

  5. Small picture about data structures

    When I've posted the first time my article Java interview for a developer. Collections. Part 2 - Maps. there was a huge discussion about the fact that the worst time complexity of add, remove and search operations are equal to lg N, if hash-function steady placed elements in buckets. A…

    java collections interview map hash map