List/Grid Core Java Subscribe to the RSS feed of category Core Java

powermock-logo

Using PowerMock to Mock Constructors

In my opinion, one of the main benefits of dependency injection is that you can inject mock and/or stub objects into your code in order to improve testability, increase test coverage and write better and more meaningful tests. The ...
java-logo

Java Hidden code

Sometime ago I came across the issue of invisible characters in Strings. These can really cause confusion because they are invisible. String a = "Hello\u200e"; String b = "Hello\u200f"; System.out.println('\'' + a ...
java-logo

Duck typing in Java ? Well, not exactly

According to Wikipedia duck typing is: style of dynamic typing in which an object’s methods and properties determine the valid semantics, rather than its inheritance from a particular class or implementa ...
openjdk-logo

Building OpenJDK on Windows

Doing some experiments, I found that it often useful to have JDK source code available in hand to make some changes, play with it, etc. So I decided to download and compile that beast. Apparently, it took me some time to do that, ...
java-logo

Java Annotations – Retention

Consider a Java annotation: public @interface AnAnnotaton {} A class with this annotation applied on it: @AnAnnotaton class AnAnnotatedClass{ } And a test which checks if this annotation is present on a class: import sta ...
java-logo

A Generic and Concurrent Object Pool

In this post we will take a look at how we can create an object pool in Java. In recent years, the performance of the JVM has multiplied manifold that object pooling for better performance has been made almost redundant for most t ...
java-logo

Java: Choosing the right Collection

Here is a quick guide for selecting the proper implementation of a Set , List , or Map in your application. The best general purpose or ‘primary’ implementations are likely ArrayList, Link ...
java-logo

Common code violations in Java

At work, recently I did a code cleanup of an existing Java project. After that exercise, I could see a common set of code violations that occur again and again in the code. So, I came up with a list of such common violations and s ...
java-logo

Java Memory Model Simplified

As a typical Java developer I never monitored the memory usage of my application apart from following typical best practices like closing the connections, streams etc.. Recently we were struck with few issues in our JBoss servers ...
java-logo

Changing delay, and hence the order, in a DelayQueue

So I was looking at building a simple object cache that expires the objects after a given time. The obvious mechanism for this is the use the DelayedQueue class from the concurrency package in Java; but I wanted to kn ...
Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.

Sign up for our Newsletter

15,153 insiders are already enjoying weekly updates and complimentary whitepapers! Join them now to gain exclusive access to the latest news in the Java world, as well as insights about Android, Scala, Groovy and other related technologies.

As an extra bonus, by joining you will get our brand new e-books, published by Java Code Geeks and their JCG partners for your reading pleasure! Enter your info and stay on top of things,

  • Fresh trends
  • Cases and examples
  • Research and insights
  • Two complimentary e-books
Get tutored by the Geeks! JCG Academy is a fact... Join Now
Hello. Add your message here.