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.Arrays;

import java.util.Collections;

import java.util.List;

public class Main {
    public static List<?> toList(Object obj) {
        if (obj instanceof List) {
            return (List<?>) obj;
        } else if (obj == null) {
            return Collections.emptyList();
        } else {
            return Arrays.asList(obj);
        }
    }
}