private void checkHasDistinctElements(Collection<T> coll) {
	// keep track of the already seen elements
	NonIterableSet<T> seenElems = new NonIterableSet<T>(coll.size());
	for(T elem : coll) {
	    if(!seenElems.add(elem)) {
		throw new IllegalArgumentException("coll has duplicate element:" + elem);
	    }
	}
    }
private void checkHasDistinctElements ( Collection < T > coll ) { NonIterableSet < T > seenElems = new NonIterableSet < T > ( coll . size ( ) ) ; for ( T elem : coll ) { if ( ! seenElems . add ( elem ) ) { throw new IllegalArgumentException ( "coll has duplicate element:" + elem ) ; } } }
Debug code: check that "coll" does not have any duplicates