Java List Contain containsUnorderedSequence(List a, List b)

Here you can find the source of containsUnorderedSequence(List a, List b)

Description

contains Unordered Sequence

License

Open Source License

Declaration

public static <T> boolean containsUnorderedSequence(List<T> a, List<T> b) 

Method Source Code

//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*/
}

Related

  1. containsSameItemsInOrder(List col1, List col2)
  2. containsStr(List list, String str)
  3. containsStringStartingWith(List list, String prefix)
  4. containsSubsequence(List a, List b)
  5. containsType(List list, Class type)
  6. containsUsingToArray(List list, Integer value)
  7. containsWhitespace(List elements)
  8. firstFunnyString(List words, String containedTest)
  9. getListValue(Object container, int index)