Here you can find the source of compareLists(List strings1, List strings2, boolean ignoreCase)
Parameter | Description |
---|---|
strings1 | a parameter |
strings2 | a parameter |
ignoreCase | a parameter |
public static boolean compareLists(List strings1, List strings2, boolean ignoreCase)
//package com.java2s; /*// w ww . j a va 2 s . co m * JBoss, Home of Professional Open Source. * * See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing. * * See the AUTHORS.txt file distributed with this work for a full listing of individual contributors. */ import java.util.List; public class Main { /** * Determines if the lists of strings contain equal strings * * @param strings1 * @param strings2 * @param ignoreCase * @return * @since 5.0 */ public static boolean compareLists(List strings1, List strings2, boolean ignoreCase) { int size1 = strings1.size(); int size2 = strings2.size(); if (size1 != size2) { return false; } for (int i = 0; i < size1; i++) { if (ignoreCase) { if (!((String) strings1.get(i)).equals(strings2.get(i))) { return false; } } else { if (!((String) strings1.get(i)).equalsIgnoreCase((String) strings2.get(i))) { return false; } } } return true; } }