Java Collection to List convertCollectionToList(final Collection collection)

Here you can find the source of convertCollectionToList(final Collection collection)

Description

convert Collection To List

License

Apache License

Declaration

public static <T> List<T> convertCollectionToList(final Collection<T> collection) 

Method Source Code

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

import java.util.ArrayList;

import java.util.Collection;

import java.util.List;

public class Main {

    public static <T> List<T> convertCollectionToList(final Collection<T> collection) {

        if (List.class.isAssignableFrom(collection.getClass())) {
            return (List<T>) collection;
        }/*from  w w  w .  j a v  a 2 s .com*/

        return new ArrayList<>(collection);

    }
}

Related

  1. collectionToList(Collection source)
  2. collectionToList(Iterable c)
  3. convertCollectionToList(Collection c)
  4. convertCollectionToList(Collection coll)
  5. convertCollectionToList(Collection collection)
  6. convertCollectionToSQL(List listId)
  7. newList(final Collection elements)
  8. newList(final Collection collection)
  9. newList(final Collection objects)