@SuppressWarnings("unchecked")
	@Override
	public boolean retainAll(Collection<?> c) {
		if (elements instanceof List<?>) {
			try {
				//TODO: copiare codice di intersection
				Collection<T> res = intersection((Collection<T>) c).elements;
				boolean r = !res.equals(elements);
				elements = res;
				return r;
			} catch (ClassCastException e) {
				return false;
			}
		}
		return elements.retainAll(c);
	}
@ SuppressWarnings ( "unchecked" ) @ Override public boolean retainAll ( Collection < ? > c ) { if ( elements instanceof List < ? > ) { try { Collection < T > res = intersection ( ( Collection < T > ) c ) . elements ; boolean r = ! res . equals ( elements ) ; elements = res ; return r ; } catch ( ClassCastException e ) { return false ; } } return elements . retainAll ( c ) ; }
{@inheritDoc}