Java List Count countOccurence(List valueList, int value)

Here you can find the source of countOccurence(List valueList, int value)

Description

count Occurence

License

Apache License

Declaration

public static int countOccurence(List<Integer> valueList, int value) 

Method Source Code

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

import java.util.Iterator;
import java.util.List;

public class Main {
    public static int countOccurence(List<Integer> valueList, int value) {
        int count = 0;
        Iterator<Integer> iterValueList = valueList.iterator();
        while (iterValueList.hasNext()) {
            int vaInList = iterValueList.next();
            if (vaInList == value) {
                count++;/*from  w w w  . j av a 2  s  .c o m*/
            }
        }
        return count;
    }
}

Related

  1. count(List values)
  2. count(List lines)
  3. countAtLevel(List aList, int aLevel)
  4. countNumber(List list, int number)
  5. countOccurances(List encodings, int value)
  6. countOccurrencesOf(Object comparisonObject, List list)