Java Collection Convert convertToCollection(Object source)

Here you can find the source of convertToCollection(Object source)

Description

convert To Collection

License

Open Source License

Declaration

private static Object convertToCollection(Object source) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    private static Object convertToCollection(Object source) {
        if (source == null) {
            return null;
        }/* www.  java  2  s.  co m*/

        if (source instanceof Collection) {
            return source;
        }

        return Collections.singleton(source);
    }
}

Related

  1. convertArrayInCollection(String[] array)
  2. convertCharCollectionToArray(Collection chars)
  3. convertCollectionInArray(Collection coll)
  4. convertCollectionStringToCSV(Collection coll, boolean valueInSingleQuotes)
  5. convertCollectionType(Iterable from, C newCollection, Class listClass)
  6. convertToHqlParameters(Collection numbers)
  7. convertToIntArray(Collection col)
  8. convertToPrimitive(Collection info)
  9. to2DIntArray(Collection coll)