check if there is No Match between two List of String - Java java.util

Java examples for java.util:List Filter

Description

check if there is No Match between two List of String

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));
    }//w ww  .  j ava 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