Home | History | Annotate | Download | only in collect

Lines Matching refs:Constraint

31  * Factories and utilities pertaining to the {@link Constraint} interface.
42 * constraint. Any operations that add new elements to the collection will
43 * call the provided constraint. However, this method does not verify that
44 * existing elements satisfy the constraint.
49 * @param constraint the constraint that validates added elements
53 Collection<E> collection, Constraint<? super E> constraint) {
54 return new ConstrainedCollection<E>(collection, constraint);
60 private final Constraint<? super E> constraint;
63 Collection<E> delegate, Constraint<? super E> constraint) {
65 this.constraint = checkNotNull(constraint);
71 constraint.checkElement(element);
75 return delegate.addAll(checkElements(elements, constraint));
81 * constraint. Any operations that add new elements to the set will call the
82 * provided constraint. However, this method does not verify that existing
83 * elements satisfy the constraint.
88 * @param constraint the constraint that validates added elements
92 Set<E> set, Constraint<? super E> constraint) {
93 return new ConstrainedSet<E>(set, constraint);
99 private final Constraint<? super E> constraint;
101 public ConstrainedSet(Set<E> delegate, Constraint<? super E> constraint) {
103 this.constraint = checkNotNull(constraint);
109 constraint.checkElement(element);
113 return delegate.addAll(checkElements(elements, constraint));
119 * constraint. Any operations that add new elements to the sorted set will
120 * call the provided constraint. However, this method does not verify that
121 * existing elements satisfy the constraint.
126 * @param constraint the constraint that validates added elements
130 SortedSet<E> sortedSet, Constraint<? super E> constraint) {
131 return new ConstrainedSortedSet<E>(sortedSet, constraint);
137 final Constraint<? super E> constraint;
140 SortedSet<E> delegate, Constraint<? super E> constraint) {
142 this.constraint = checkNotNull(constraint);
148 return constrainedSortedSet(delegate.headSet(toElement), constraint);
152 delegate.subSet(fromElement, toElement), constraint);
155 return constrainedSortedSet(delegate.tailSet(fromElement), constraint);
158 constraint.checkElement(element);
162 return delegate.addAll(checkElements(elements, constraint));
168 * constraint. Any operations that add new elements to the list will call the
169 * provided constraint. However, this method does not verify that existing
170 * elements satisfy the constraint.
176 * @param constraint the constraint that validates added elements
180 List<E> list, Constraint<? super E> constraint) {
182 ? new ConstrainedRandomAccessList<E>(list, constraint)
183 : new ConstrainedList<E>(list, constraint);
190 final Constraint<? super E> constraint;
192 ConstrainedList(List<E> delegate, Constraint<? super E> constraint) {
194 this.constraint = checkNotNull(constraint);
201 constraint.checkElement(element);
205 constraint.checkElement(element);
209 return delegate.addAll(checkElements(elements, constraint));
213 return delegate.addAll(index, checkElements(elements, constraint));
216 return constrainedListIterator(delegate.listIterator(), constraint);
219 return constrainedListIterator(delegate.listIterator(index), constraint);
222 constraint.checkElement(element);
227 delegate.subList(fromIndex, toIndex), constraint);
235 List<E> delegate, Constraint<? super E> constraint) {
236 super(delegate, constraint);
242 * specified constraint. Any operations that would add new elements to the
243 * underlying list will be verified by the constraint.
246 * @param constraint the constraint for elements in the list
250 ListIterator<E> listIterator, Constraint<? super E> constraint) {
251 return new ConstrainedListIterator<E>(listIterator, constraint);
257 private final Constraint<? super E> constraint;
260 ListIterator<E> delegate, Constraint<? super E> constraint) {
262 this.constraint = constraint;
269 constraint.checkElement(element);
273 constraint.checkElement(element);
279 Collection<E> collection, Constraint<E> constraint) {
281 return constrainedSortedSet((SortedSet<E>) collection, constraint);
283 return constrainedSet((Set<E>) collection, constraint);
285 return constrainedList((List<E>) collection, constraint);
287 return constrainedCollection(collection, constraint);
297 Collection<E> elements, Constraint<? super E> constraint) {
300 constraint.checkElement(element);