Author: joehni
Date: Thu Mar  3 17:48:24 2011
New Revision: 1076703

URL: http://svn.apache.org/viewvc?rev=1076703&view=rev
Log:
Fix missing new in example. Fix javadoc. Fix code style.

Modified:
    
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ArrayUtils.java

Modified: 
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ArrayUtils.java
URL: 
http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ArrayUtils.java?rev=1076703&r1=1076702&r2=1076703&view=diff
==============================================================================
--- 
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ArrayUtils.java
 (original)
+++ 
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ArrayUtils.java
 Thu Mar  3 17:48:24 2011
@@ -257,13 +257,11 @@ public class ArrayUtils {
      * <p>Arrays are covariant i.e. they cannot be created from a generic 
type:</p>
      *
      * <pre>
-    public static &lt;T&gt; T[] createAnArray(int size)
-    {
+    public static &lt;T&gt; T[] createAnArray(int size) {
         return T[size]; // compiler error here
     }
-    public static &lt;T&gt; T[] createAnArray(int size)
-    {
-        return (T[])Object[size]; // ClassCastException at runtime
+    public static &lt;T&gt; T[] createAnArray(int size) {
+        return (T[])new Object[size]; // ClassCastException at runtime
     }
      * </pre>
      *
@@ -280,7 +278,7 @@ public class ArrayUtils {
      * 
      * Note, this method makes only sense to provide arguments of the same 
type so that the
      * compiler can deduce the type of the array itself. While it is possible 
to select the
-     * type explicitly like in <code>Number[] array = 
ArrayUtils.<Number>toArray(new
+     * type explicitly like in <code>Number[] array = 
ArrayUtils.&lt;Number&gt;toArray(new
      * Integer(42), new Double(Math.PI))</code>, there is no real advantage to 
<code>new
      * Number[] {new Integer(42), new Double(Math.PI)}</code> anymore.
      *
@@ -289,8 +287,7 @@ public class ArrayUtils {
      * @return the array
      * @since  3.0
      */
-    public static <T> T[] toArray(final T... items)
-    {
+    public static <T> T[] toArray(final T... items) {
         return items;
     }
     


Reply via email to