The Daily WTF
Follow
Representative Line: Listing Off the Problems
Mike shared a line of Java code that, while not a WTF itself, hints at underlying issues. The code declares an array of ArrayLists: ArrayList[] data = new ArrayList[dataList.size()]. This creates an array of ArrayLists with a size corresponding to the dataList. The author speculates this might be an attempt to use object-orientation with lists. It could be that each object in dataList will be converted into an ArrayList of its values. The code might predate Java generics or intentionally use a non-generic version for this conversion. Without further context, this remains speculation. However, such code often signals a problem to experienced programmers. This line serves as a warning sign of potential complexities or design flaws. The presence of this line suggests deeper issues within the codebase.