Java List Contain containsOnlySequentialNumbers(List values)

Here you can find the source of containsOnlySequentialNumbers(List values)

Description

contains Only Sequential Numbers

License

Apache License

Declaration

public static boolean containsOnlySequentialNumbers(List<Integer> values) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.List;

public class Main {
    public static boolean containsOnlySequentialNumbers(List<Integer> values) {
        for (int i = 0; i < values.size() - 1; i++) {
            if (values.get(i) != values.get(i + 1) - 1) {
                return false;
            }//from   w  ww.ja  v  a  2s  .c o m
        }
        return true;
    }
}

Related

  1. containsNullElement(List source)
  2. containsOneEqualElem(List first, List second)
  3. containsOnly(List elements, Class clazz)
  4. containsOnlyEmptyValues(List list)
  5. containsOnlyNulls(List list)
  6. containsOrIsEmpty(List list, Object item)
  7. containsReference(List references, Object toBeFound)
  8. containsSameItemsInOrder(List col1, List col2)
  9. containsStr(List list, String str)