Here you can find the source of containsUnorderedSequence(List
public static <T> boolean containsUnorderedSequence(List<T> a, List<T> b)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static <T> boolean containsUnorderedSequence(List<T> a, List<T> b) { int remaining = a.size() - b.size(); for (int i = 0; i < remaining; i++) if (a.subList(i, i + b.size()).containsAll(b)) return true; return false; }/*from w w w . j av a 2 s. c o m*/ }