Java ArrayList to Array toStringArr(ArrayList al)

Here you can find the source of toStringArr(ArrayList al)

Description

to String Arr

License

Apache License

Declaration

public static String[] toStringArr(ArrayList al) 

Method Source Code


//package com.java2s;
/*//from  w w w .  ja va 2s.c o m
Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable
    
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
    
   http://www.apache.org/licenses/LICENSE-2.0
    
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    
See the License for the specific language governing permissions and
limitations under the License.
*/

import java.util.ArrayList;
import java.util.Set;

public class Main {
    static String[] stringArr = new String[0];

    public static String[] toStringArr(ArrayList al) {
        return (String[]) al.toArray(stringArr);
    }

    public static String[] toStringArr(Set set) {
        return (String[]) set.toArray(stringArr);
    }
}

Related

  1. toByteArray(ArrayList in)
  2. toIntArray(ArrayList list)
  3. toIntArray(ArrayList array)
  4. toIntArray(ArrayList array)
  5. toIntArray(ArrayList input)
  6. toStringArray(ArrayList src)
  7. toStringArray(ArrayList src)
  8. toStringArrayList(final Object... array)