home *** CD-ROM | disk | FTP | other *** search
- package java.util;
-
- import java.io.Serializable;
- import java.lang.reflect.Array;
-
- class Collections$CheckedCollection<E> implements Collection<E>, Serializable {
- private static final long serialVersionUID = 1578914078182001775L;
- // $FF: renamed from: c java.util.Collection
- final Collection<E> field_0;
- final Class<E> type;
- private E[] zeroLengthElementArray = null;
-
- void typeCheck(Object var1) {
- if (!this.type.isInstance(var1)) {
- throw new ClassCastException("Attempt to insert " + var1.getClass() + " element into collection with element type " + this.type);
- }
- }
-
- Collections$CheckedCollection(Collection<E> var1, Class<E> var2) {
- if (var1 != null && var2 != null) {
- this.field_0 = var1;
- this.type = var2;
- } else {
- throw new NullPointerException();
- }
- }
-
- public int size() {
- return this.field_0.size();
- }
-
- public boolean isEmpty() {
- return this.field_0.isEmpty();
- }
-
- public boolean contains(Object var1) {
- return this.field_0.contains(var1);
- }
-
- public Object[] toArray() {
- return this.field_0.toArray();
- }
-
- public <T> T[] toArray(T[] var1) {
- return (T[])this.field_0.toArray(var1);
- }
-
- public String toString() {
- return this.field_0.toString();
- }
-
- public boolean remove(Object var1) {
- return this.field_0.remove(var1);
- }
-
- public boolean containsAll(Collection<?> var1) {
- return this.field_0.containsAll(var1);
- }
-
- public boolean removeAll(Collection<?> var1) {
- return this.field_0.removeAll(var1);
- }
-
- public boolean retainAll(Collection<?> var1) {
- return this.field_0.retainAll(var1);
- }
-
- public void clear() {
- this.field_0.clear();
- }
-
- public Iterator<E> iterator() {
- return new Collections.CheckedCollection.1(this);
- }
-
- public boolean add(E var1) {
- this.typeCheck(var1);
- return this.field_0.add(var1);
- }
-
- public boolean addAll(Collection<? extends E> var1) {
- Object var2 = null;
-
- try {
- var2 = var1.toArray(this.zeroLengthElementArray());
- } catch (ArrayStoreException var8) {
- throw new ClassCastException();
- }
-
- boolean var3 = false;
-
- for(Object var7 : var2) {
- var3 |= this.field_0.add(var7);
- }
-
- return var3;
- }
-
- E[] zeroLengthElementArray() {
- if (this.zeroLengthElementArray == null) {
- this.zeroLengthElementArray = (E[])((Object[])Array.newInstance(this.type, 0));
- }
-
- return this.zeroLengthElementArray;
- }
- }
-