vargs are a cool feature in java that has gained some traction since their availability in JDK 1.5. However, there are some nuances when working with them that if you don't keep straight, can require quite a bit of Googling to figure out. Since I keep tripping up on this one myself, I figured I would write a quick post as a reminder for myself. In java, when dealing with a method that accepts a variable number of parameters (vargs), if you pass an array in as the parameter, it will be parsed as a list of parameters. Take this example:
...
e have all read it or heard someone talk about it. "Static Methods are Death to Testability". You can read the article here: http://bit.ly/4mk3fP. Something that has become a fundimental piece of the language (all you need to do is look at the Apache Commons project to see that) is so bad that it must be avoided at all costs in the name of testing. Gosling (or someone on his team) put it in the language for a reason and to avoid those uses solely because your toolset doesn't support the testing of it is nonsense. Time to get a new toolset. In this tutorial we will cover how to mock static methods (*gasp) using PowerMock.
More
Want lightbox functionality but don't want to add yet another javascript library to your project? Prototype and script.aculo.us are probably two javascript libraries you already have in your project. Here we will cover a lightweight way to implement lightbox functionality without adding yet another javascript library.
More
| About MichaelMinella.com |
|
|
|
|