Here you can find the source of toArrayElement(String s)
Parameter | Description |
---|---|
s | The element to be wrapped |
public static String[] toArrayElement(String s)
//package com.java2s; //License from project: Apache License public class Main { /**/*from w w w . ja v a 2s .c o m*/ * Takes a String s and returns a new String[1] with s as the only element. * If s is null or "", return String[0]. * * @param s The element to be wrapped * @return String[] */ public static String[] toArrayElement(String s) { return (s == null || s.length() == 0) ? new String[0] : new String[] { s }; } }