check No Match between two List - Java java.util

Java examples for java.util:List Compare

Description

check No Match between two List

Demo Code


//package com.java2s;

import java.util.List;

public class Main {
    public static void main(String[] argv) {
        List proposalList = java.util.Arrays.asList("asdf", "java2s.com");
        List nonexpectedList = java.util.Arrays
                .asList("asdf", "java2s.com");
        System.out.println(checkNoMatch(proposalList, nonexpectedList));
    }/*from   ww  w.j  av a  2 s  .  co  m*/

    public static boolean checkNoMatch(List<String> proposalList,
            List<String> nonexpectedList) {
        boolean noMatch = true;
        for (String proposeValue : proposalList) {
            for (String nonexpectedValue : nonexpectedList) {
                if (proposeValue.equals(nonexpectedValue)) {
                    noMatch = false;
                    break;
                }
            }
        }
        return noMatch;
    }
}

Related Tutorials