Here you can find the source of contains(Iterator
Parameter | Description |
---|---|
iterator | a parameter |
value | a parameter |
public static boolean contains(Iterator<String> iterator, String value)
//package com.java2s; /*//from w w w . j av a 2 s . co m * The contents of this file are subject to the license and copyright * detailed in the LICENSE and NOTICE files at the root of the source * tree and available online at * * http://duracloud.org/license/ */ import java.util.Iterator; public class Main { /** * Determines if a String value is included in a Iterated list. * The iteration is only run as far as necessary to determine * if the value is included in the underlying list. * * @param iterator * @param value * @return */ public static boolean contains(Iterator<String> iterator, String value) { if (iterator == null || value == null) { return false; } while (iterator.hasNext()) { if (value.equals(iterator.next())) { return true; } } return false; } }