Java Collection Element Get getArrays(Object parent, Collection collection)

Here you can find the source of getArrays(Object parent, Collection collection)

Description

get Arrays

License

Open Source License

Declaration

public static Object[] getArrays(Object parent, Collection collection) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2008 Sybase, Inc.//from ww w  .ja  v a2  s.c om
 * 
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0 which
 * accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors: Sybase - initial API and implementation
 ******************************************************************************/

import java.util.Collection;

public class Main {
    private static final Object[] EMPTY_ELEMENT_ARRAY = new Object[0];

    public static Object[] getArrays(Object parent, Collection collection) {
        if (collection.isEmpty()) {
            return EMPTY_ELEMENT_ARRAY;
        } else {
            //            if (parent instanceof IVirtualNode && !((IVirtualNode) parent).hasChildren())
            //            {
            //                ((IVirtualNode) parent).addChildren(collection);
            //            }
            //            return collection.toArray(new Object[collection.size()]);
            return collection.toArray();
        }
    }
}

Related

  1. getAnyFrom(Collection collection)
  2. getArbitraryMember(Collection s)
  3. getArray(Collection dnaCol)
  4. getArrayFromCollection( Collection collection)
  5. GetArrayFromCollection(java.util.Collection col)
  6. getAssociationCollectionObjectName(Collection currentObjectColl, Collection prevObjectColl)
  7. getAsString(Collection data, char seperator)
  8. getAsString(Collection input)
  9. getAt(Collection col, int index)