src/main/java/org/organicdesign/fp/collections/Cowry.java
@SuppressWarnings("unchecked")
    public static <T> T[] singleElementArray(T elem, Class<T> tClass) {
        if (tClass == null) {
            return (T[]) new Object[] { elem };
        }

        T[] newItems = (T[]) Array.newInstance(tClass, 1);
        newItems[0] = elem;
        return newItems;
    }
@SuppressWarnings("unchecked")
    public static <T> T[] singleElementArray(T elem, Class<T> tClass) {
        if (tClass == null) {
            return (T[]) new Object[] { elem };
        }

        T[] newItems = (T[]) Array.newInstance(tClass, 1);
        newItems[0] = elem;
        return newItems;
    }
@ SuppressWarnings ( "unchecked" ) public static < T > T [ ] singleElementArray ( T elem , Class < T > tClass ) { if ( tClass == null ) { return ( T [ ] ) new Object [ ] { elem } ; } T [ ] newItems = ( T [ ] ) Array . newInstance ( tClass , 1 ) ; newItems [ 0 ] = elem ; return newItems ; }
Helper function to avoid type warnings.
@param elem the item to put in the array.
@param tClass the class of the array.
@return an array of the appropriate class containing the single element.
Helper function to avoid type warnings .