Women in Technology

Hear us Roar



Article:
  Creating Varargs in Java 1.5 Tiger
Subject:   Are varargs an improvement?
Date:   2004-10-08 15:55:03
From:   MarcinJeske
Response to: Are varargs an improvement?

It's good to see that you are keeping an eye on comments. Just to add a few thought:


You may be right that first-time programmers learning Java, as opposed to those coming from other languages, are not as confortable using arrays. After working with arrays in C/C++, using them in Java is a dream... the same simplicity and power but without the inherent bugs (pointer error, bounds-checking, type errors). As much as the collections classes are necessary and useful to describe dynamically changing groups, set-style notation, and underlying performance needs, nothing beats the ease of creating, initializing, and altering elements in an array. ( new int [] {1,2,3} )


On the other hand, I wouldn't mind if there were improvements. After becoming familiar with the array operations of Python and Perl, I've found myself wishing for those operations Java, and creating helper methods which mimic them:


Namely, array slices, where a new array is returned containing a subset of the original between a range of indices ( public Object [] slice(Object [], int start, int end); ), or a subset is returned based on an array of indices ( public Object [] slice(Object [], int [] indices); )


I much prefer the Python to the Perl syntax...


Anyway, I appreciate the response.


Marcin