Java Collection to Array toArray(T arrayOrCollection)

Here you can find the source of toArray(T arrayOrCollection)

Description

to Array

License

Open Source License

Declaration

public static <T> Object[] toArray(T arrayOrCollection) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Collection;

public class Main {
    public static <T> Object[] toArray(T arrayOrCollection) {
        if (arrayOrCollection instanceof Collection) {
            return ((Collection) arrayOrCollection).toArray();
        } else {/*from w  ww. ja v  a2s  .  c o m*/
            return (Object[]) arrayOrCollection;
        }
    }
}

Related

  1. toArray(final Collection c)
  2. toArray(final Collection coll, byte[] array)
  3. toArray(final Collection collection)
  4. toArray(final Collection collection)
  5. toArray(java.util.Collection collection)
  6. toArrayInt(Collection integerCollection)
  7. toArrays(Collection strings)
  8. toArrayString(Collection col, boolean spacing)
  9. toBaseTypedCollection(Collection initial)