Java List Merge mergeToList(Object src, Object... args)

Here you can find the source of mergeToList(Object src, Object... args)

Description

merge To List

License

Open Source License

Declaration

public static List mergeToList(Object src, Object... args) 

Method Source Code


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

import java.util.ArrayList;

import java.util.List;

public class Main {
    public static List mergeToList(Object src, Object... args) {
        List valList = new ArrayList();
        add(valList, src);/*w  w  w .j  av  a 2  s  .co m*/
        for (Object arg : args) {
            add(valList, arg);
        }
        return valList;
    }

    public static List add(List valList, Object src) {
        if (src == null) {
            return valList;
        }
        if (src instanceof List) {
            valList.addAll((List) src);
        } else {
            valList.add(src);
        }
        return valList;
    }
}

Related

  1. mergerList(List sources, List targets)
  2. mergeSpeakerList(List speaker_list)
  3. mergeString(List strs)
  4. mergeTimeStrings(List strs)
  5. mergeTo(List target, List source)
  6. mergeUniqElems(List src, List dest)
  7. safetyMergeCollection(List src, List target)

  8. HOME | Copyright © www.java2s.com 2016