1 16 package org.apache.commons.collections.collection; 17 18 import java.util.Collection ; 19 import java.util.Iterator ; 20 21 42 public abstract class AbstractCollectionDecorator implements Collection { 43 44 45 protected Collection collection; 46 47 51 protected AbstractCollectionDecorator() { 52 super(); 53 } 54 55 61 protected AbstractCollectionDecorator(Collection coll) { 62 if (coll == null) { 63 throw new IllegalArgumentException ("Collection must not be null"); 64 } 65 this.collection = coll; 66 } 67 68 73 protected Collection getCollection() { 74 return collection; 75 } 76 77 public boolean add(Object object) { 79 return collection.add(object); 80 } 81 82 public boolean addAll(Collection coll) { 83 return collection.addAll(coll); 84 } 85 86 public void clear() { 87 collection.clear(); 88 } 89 90 public boolean contains(Object object) { 91 return collection.contains(object); 92 } 93 94 public boolean isEmpty() { 95 return collection.isEmpty(); 96 } 97 98 public Iterator iterator() { 99 return collection.iterator(); 100 } 101 102 public boolean remove(Object object) { 103 return collection.remove(object); 104 } 105 106 public int size() { 107 return collection.size(); 108 } 109 110 public Object [] toArray() { 111 return collection.toArray(); 112 } 113 114 public Object [] toArray(Object [] object) { 115 return collection.toArray(object); 116 } 117 118 public boolean containsAll(Collection coll) { 119 return collection.containsAll(coll); 120 } 121 122 public boolean removeAll(Collection coll) { 123 return collection.removeAll(coll); 124 } 125 126 public boolean retainAll(Collection coll) { 127 return collection.retainAll(coll); 128 } 129 130 public boolean equals(Object object) { 131 if (object == this) { 132 return true; 133 } 134 return collection.equals(object); 135 } 136 137 public int hashCode() { 138 return collection.hashCode(); 139 } 140 141 public String toString() { 142 return collection.toString(); 143 } 144 145 } 146 | Popular Tags |