Here you can find the source of merge(List
public static <T> void merge(List<T> a, List<T> b, Comparator<T> comp)
//package com.java2s; /*/*ww w.j a v a 2 s . co m*/ * Copyright (c) 2014 Tor C Bekkvik * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import java.util.*; public class Main { public static <T> void merge(List<T> a, List<T> b, Comparator<T> comp) { b.addAll(a); b.sort(comp); } public static <T> List<T> sort(List<T> unsorted, Comparator<T> comp) { List<T> lst = new ArrayList<>(unsorted); lst.sort(comp); return lst; } }