Home » Archive

Articles tagged with: language

design, education »

[10 Nov 2007 | 13 Comments | ]

As a second-generation Iranian American, who has spent practically no time in Iran, I have found it difficult to learn the Persian language beyond mere kitchen talk. In an effort to improve my vocabulary, I sought out a list of the most common Persian words. I could not find such a list, so I searched for a Persian-language corpus that I could use to produce the list myself.
I came across the Hamshahri Persian Corpus and decided to use it. I ran a word count on the corpus to determine what …

tools »

[2 Sep 2006 | Comments Off on hashCode() in Java 1.5 | ]

Can anybody think of a reason why you can’t just have a generic hashCode() utility in Java 1.5 that utilizes autoboxing and variable argument lists? I’ve been using the following code:
public static int computeHashCode(Object… o) { int result = 17; for (int i = 0; i < o.length; i++) { result = 37 * result + (null == o[i] ? 0 : o[i].hashCode()); } return result;}
It could be called as follows:
public int hashCode() { return computeHashCode(var1, var2, var3, var4, var5);}
Because of autoboxing, …