* {@link Collections#unmodifiableCollection(Collection)}, this class checks its
* argument to ensure multiple encapsulation does not occur.
*
- * this class checks
+ * <p>This class checks
* the argument so it prevents multiple encapsulation. Subclasses of
* {@link ImmutableCollection} are also recognized and not encapsulated.
- * An attempt is also made to identi
*
* @param <E> the type of elements in this collection
*/
private static final Collection<Class<?>> SINGLETON_CLASSES;
static {
- UNMODIFIABLE_COLLECTION_CLASS = Collections.unmodifiableCollection(new ArrayList<Object>()).getClass();
+ UNMODIFIABLE_COLLECTION_CLASS = Collections.unmodifiableCollection(new ArrayList<>()).getClass();
final Builder<Class<?>> b = ImmutableSet.builder();
b.add(Collections.singleton(null).getClass());
return new UnmodifiableCollection<>(collection);
}
+ @Nonnull
@Override
public Iterator<E> iterator() {
return Iterators.unmodifiableIterator(delegate.iterator());
}
@Override
- public <T> T[] toArray(final T[] a) {
+ public <T> T[] toArray(@Nonnull final T[] a) {
return delegate.toArray(a);
}
@Override
- public boolean containsAll(final Collection<?> c) {
+ public boolean containsAll(@Nonnull final Collection<?> c) {
return delegate.containsAll(c);
}
}
@Override
- public boolean addAll(final Collection<? extends E> c) {
+ public boolean addAll(@Nonnull final Collection<? extends E> c) {
throw new UnsupportedOperationException();
}
}
@Override
- public boolean removeAll(final Collection<?> c) {
+ public boolean removeAll(@Nonnull final Collection<?> c) {
throw new UnsupportedOperationException();
}
@Override
- public boolean retainAll(final Collection<?> c) {
+ public boolean retainAll(@Nonnull final Collection<?> c) {
throw new UnsupportedOperationException();
}