Code example for Set

Methods: addcontains

0
	/** 
	 * Add given iterator to this composite. 
	 */ 
	public void add(Iterator<E> iterator) {
		Assert.state(!this.inUse, "You can no longer add iterators to a composite iterator that's already in use");
		if (this.iterators.contains(iterator)) {
			throw new IllegalArgumentException("You cannot add the same iterator twice");
		} 
		this.iterators.add(iterator);
	} 
 
	@Override 
	public boolean hasNext() { 
		this.inUse = true;
		for (Iterator<E> iterator : this.iterators) {
			if (iterator.hasNext()) {
				return true; 
			} 
		} 
		return false; 
Contextual code suggestions in your IDE  Get Codota for Java