fixed the constructor.

This commit is contained in:
javasabr 2017-09-19 07:16:35 +03:00 committed by Rémy Bouquet
parent 69b7f7e655
commit 06599d1eac

View File

@ -99,13 +99,7 @@ public class SafeArrayList<E> implements List<E>, Cloneable {
public SafeArrayList(final Class<E> elementType, final Collection<? extends E> collection) {
this.elementType = elementType;
if (collection instanceof SafeArrayList) {
this.buffer = Arrays.asList(((SafeArrayList<E>) collection).getArray());
} else {
this.buffer = new ArrayList<>(collection);
}
this.buffer = new ArrayList<>(collection);
this.size = buffer.size();
}