From 17a6cb3332ebe6751299dc92b612635e644516c5 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Wed, 24 Feb 2010 02:07:36 +0000 Subject: [PATCH] Comment pedantry. Considered adding a note that toArray() is generally not safe, but the Collections run through here in normal depot usage will be safe to use. Check out the implementation of AbstractCollection's toArray(T[]). --- src/java/com/samskivert/depot/util/Sequence.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/java/com/samskivert/depot/util/Sequence.java b/src/java/com/samskivert/depot/util/Sequence.java index ad95f78..fb0e957 100644 --- a/src/java/com/samskivert/depot/util/Sequence.java +++ b/src/java/com/samskivert/depot/util/Sequence.java @@ -65,6 +65,7 @@ public abstract class Sequence implements Iterable } return list; } + // In a perfect world this would be S[] toArray (Class clazz) public T[] toArray (Class clazz) { @SuppressWarnings("unchecked") T[] array = (T[]) Array.newInstance(clazz, source.size()); @@ -91,13 +92,13 @@ public abstract class Sequence implements Iterable public abstract boolean isEmpty (); /** - * Converts this sequence into an array list. + * Converts this sequence into an ArrayList. */ public abstract ArrayList toList (); /** * Converts this sequence into an array. - * I wish this were S[] toArray (Class S[] toArray (Class clazz); */ public abstract T[] toArray (Class clazz); }