Java Utililty Methods List Difference

List of utility methods to do List Difference

Description

The list of methods to do List Difference are organized into topic(s).

Method

ListgetLeftDiff(List list1, List list2)
get Left Diff
if (isEmpty(list2)) {
    return list1;
List<T> list = new ArrayList<T>();
if (isNotEmpty(list1)) {
    for (T o : list1) {
        if (!list2.contains(o)) {
            list.add(o);
...
StringgetListsDiffFormatted(List list0, List list1)
Get formatted difference between list0 and list1
StringBuffer sb = new StringBuffer("");
if (list0 == null && list1 == null) {
    sb.append("<null> == <null>");
} else if (list0 == null) {
    sb.append("<null> != <not null>");
} else if (list1 == null) {
    sb.append("<null> != <not null>");
} else {
...
doublegetScoreSeriesByMinMaxAndDiff(List percentClaimedHistory)
get Score Series By Min Max And Diff
Integer first = percentClaimedHistory.get(0);
Integer current = percentClaimedHistory.get(percentClaimedHistory.size() - 1);
int diff = current.intValue() - first.intValue();
double score = diff * Math.pow(retrieveMinimumNotZeroDifference(percentClaimedHistory), -1);
return score;
booleanhasRemoval(List differences, String path)
Check if the list of differences contains the removal of a key, the key is a path part1.part2.part3
final String pattern = String.format("-%s:", path);
return lookForPattern(differences, pattern);
intmaxDiffBetweenCompressedWayNodes(final List wayNodeOffsets)
Computes the maximum absolute difference in the list of way node offsets.
int maxDiff = 0;
for (int diff : wayNodeOffsets.subList(2, wayNodeOffsets.size())) {
    diff = Math.abs(diff);
    if (diff > maxDiff)
        maxDiff = diff;
return maxDiff;
intretrieveMinimumNotZeroDifference(List percentClaimedHistory)
retrieve Minimum Not Zero 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;
...