Java Collection Create toCollection(String value)

Here you can find the source of toCollection(String value)

Description

to Collection

License

Open Source License

Declaration

public static Collection<String> toCollection(String value) 

Method Source Code


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

import java.util.ArrayList;
import java.util.Collection;

public class Main {
    public static Collection<String> toCollection(String value) {
        if (value == null) {
            throw new IllegalArgumentException("Cannot add null value to collection.");
        }/*from  w w  w . ja  va2  s .c o  m*/

        Collection<String> collection = new ArrayList<String>();

        collection.add(value);

        return collection;
    }
}

Related

  1. toCollection(final Iterable iterable)
  2. toCollection(final T[] elements)
  3. toCollection(Iterable iterable)
  4. toCollection(Iterable i)
  5. toCollection(Object o)