Java Array From toArray(Object a)

Here you can find the source of toArray(Object a)

Description

Gives an Object array containing the passed parameter

License

Open Source License

Declaration

public static Object[] toArray(Object a) 

Method Source Code

//package com.java2s;
/*********************************************************************
 * This computer program is the confidential information and proprietary
 * trade secret of Cisco Systems, Inc.  Possessions and use of this
 * program must conform strictly to the license agreement between the user
 * and Cisco Systems, Inc., and receipt or possession does not convey
 * any rights to divulge, reproduce, or allow others to use this program
 * without specific written authorization of Cisco Systems, Inc.
 *
 * Copyright (c) 2001 by Cisco Systems, Inc.
 * All rights reserved.//from  w  w w .  j  a va  2  s.  c  o  m
 *
 *********************************************************************/

public class Main {
    /**
     * Gives an Object array containing the passed parameter
     */
    public static Object[] toArray(Object a) {
        return new Object[] { a };
    }

    /**
     * Gives an Object array containing the passed parameters
     */
    public static Object[] toArray(Object a, Object b) {
        return new Object[] { a, b };
    }

    /**
     * Gives an Object array containing the passed parameters
     */
    public static Object[] toArray(Object a, Object b, Object c) {
        return new Object[] { a, b, c };
    }

    /**
     * Gives an Object array containing the passed parameters
     */
    public static Object[] toArray(Object a, Object b, Object c, Object d) {
        return new Object[] { a, b, c, d };
    }
}

Related

  1. toArray(int value, byte b[], int offset)
  2. toArray(int[] intArray)
  3. toArray(Iterable itr)
  4. toArray(long l, byte[] b, int offset)
  5. toArray(long value, byte[] dest, int offset, int length)
  6. toArray(Object foo)
  7. toArray(Object o)
  8. toArray(Object... args)
  9. toArray(Object... values)