Java List Cast castToStringList(Object value)

Here you can find the source of castToStringList(Object value)

Description

cast To String List

License

LGPL

Declaration

@SuppressWarnings("unchecked")
    public static List<String> castToStringList(Object value) 

Method Source Code


//package com.java2s;
//License from project: LGPL 

import java.util.ArrayList;

import java.util.List;

public class Main {
    @SuppressWarnings("unchecked")
    public static List<String> castToStringList(Object value) {
        List<String> result;
        try {/*from ww w  . ja  v  a 2 s .co  m*/
            result = (List<String>) value;
        } catch (Exception e) {
            result = null;
        }
        if (result == null) {
            return new ArrayList<String>();
        }
        return result;
    }
}

Related

  1. castNonNullListParameterTo(String parameterName, List value, Class requiredType)
  2. castOrCopyToList(Iterable iterable)
  3. castTo(final List list, final Class clasz)
  4. castToDocumentList(Object obj)
  5. castToList(U[] array, Class clazz)
  6. IS_CASTABLE_LIST(Class className, Object obj)
  7. listToJsonArray(List ll, Class toCast, String jsonArrayKey)
  8. toStringList(List uncastedValues)

    HOME | Copyright © www.java2s.com 2016