Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Main {
    public static List<String> stringToList(String weeksStr) {
        List<String> weekList = new ArrayList<>();
        if (weeksStr == null || weekList.isEmpty()) {
            return weekList;
        }
        String[] weeksArray = weeksStr.split(",");
        if (weeksArray.length != 0) {
            weekList = Arrays.asList(weeksArray);
        } else {
            weekList.add(weeksStr);
        }
        return weekList;
    }
}