Category Archives: java

Java: Converting a List to an Array

For some reason, I always keep forgetting how to do this, without using a for-loop. import java.util.ArrayList;  import java.util.List; public class ConvertListToArray { public static void main(String[] args) { ArrayList list = new ArrayList(); list.add(“test1”); list.add(“test2”); list.add(“test3”); String[] arrayOfStrings = … Continue reading

Posted in code example, java | Leave a comment

Ruby On Rails

At work, I mostly work on java related projects, but occasionally I get thrown some ruby on rails work.  I’ve always seen myself as a java coder with some ruby experience. Just recently, Dave Hover, author of my favorite book … Continue reading

Posted in java, ruby | Tagged | 1 Comment

Dependency Injection with Spring

I was recently made aware that being a java developer in this day and age that I should have working familiarity with the Spring Framework. Some of you already know that I have devoted November as Spring month and have … Continue reading

Posted in java | Leave a comment

Note to Myself: String Concatenation

In the effort of trying to make my java code NOT look like it was written 10 years ago, here’s another note to myself. Use String.format for concatenating strings, especially when concatenating strings within strings. In other words… Do less … Continue reading

Posted in it makes your code look old, java | Leave a comment

Note to Myself: Iterators and For-Each Loops

This is a note to myself. When coding in java, stop using Iterators where you can by replacing them with a for-each loop. So in other words… Stop doing this: for ( Iterator<?> vectorIterator = vector.iterator(); vectorIterator.hasNext();) { System.out.println( (String) … Continue reading

Posted in it makes your code look old, java | Leave a comment

HttpClient with Feed Protocol

Took me a while to figure this out. If you’re using Apache’s HttpClient and need to change its default protocol from “http” to “feed”, this is how you do it in the code snippet below. HttpClient client = new HttpClient(); … Continue reading

Posted in code example, general, java | Leave a comment