Java List Contain pathContains(List path, String source, String label, String target)

Here you can find the source of pathContains(List path, String source, String label, String target)

Description

path Contains

License

Open Source License

Declaration

public static boolean pathContains(List<String> path, String source, String label, String target) 

Method Source Code

//package com.java2s;
/**/*from w  w  w.  j  a v  a  2  s .c  om*/
 * Copyright (C) 2009 G?nter Ladwig (gla at aifb.uni-karlsruhe.de)
 * 
 * This file is part of the graphindex project.
 *
 * graphindex is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License, version 2
 * as published by the Free Software Foundation.
 * 
 * graphindex is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with graphindex.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.util.List;

public class Main {
    public static boolean pathContains(List<String> path, String source, String label, String target) {
        for (int i = 0; i < path.size() - 2; i += 2) {
            if (path.get(i).equals(source)) {
                if (path.get(i + 1).equals(label) && path.get(i + 2).equals(target))
                    return true;
            }
        }
        return false;
    }
}

Related

  1. isContains(final Object value, final Object... list)
  2. isContains(List roles, String role, String module)
  3. isEitherContains(List one, List two)
  4. isListContainAll(List list, T... checkItems)
  5. isListContainsDuplicateElement(List oneList)
  6. replaceWithList(List containingList, String key, List list)
  7. strContainsbyList(String str, List filterList)
  8. stringContains(String line, List list)
  9. stringContainsItemFromList(String inputString, List items)