Java List Difference retrieveMinimumNotZeroDifference(List percentClaimedHistory)

Here you can find the source of retrieveMinimumNotZeroDifference(List percentClaimedHistory)

Description

retrieve Minimum Not Zero Difference

License

Apache License

Declaration

private static int retrieveMinimumNotZeroDifference(List<Integer> percentClaimedHistory) 

Method Source Code

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

import java.util.List;

public class Main {
    private static int retrieveMinimumNotZeroDifference(List<Integer> percentClaimedHistory) {
        // Let's assume the higher difference
        int minimumDifference = 100;
        for (int i = 0; i < percentClaimedHistory.size(); i++) {
            Integer outerPercent = percentClaimedHistory.get(i);
            for (int j = 0; j < percentClaimedHistory.size(); j++) {
                Integer innerPercent = percentClaimedHistory.get(j);
                int currentDifference = Math.abs(outerPercent - innerPercent);
                if (currentDifference != 0 && currentDifference < minimumDifference) {
                    minimumDifference = currentDifference;
                }//from   ww  w .j a v a  2 s  . c  o m
            }
        }
        return minimumDifference;
    }
}

Related

  1. getLeftDiff(List list1, List list2)
  2. getListsDiffFormatted(List list0, List list1)
  3. getScoreSeriesByMinMaxAndDiff(List percentClaimedHistory)
  4. hasRemoval(List differences, String path)
  5. maxDiffBetweenCompressedWayNodes(final List wayNodeOffsets)