~ubuntu-branches/ubuntu/wily/gs-collections/wily

« back to all changes in this revision

Viewing changes to collections/src/main/java/com/gs/collections/impl/stack/mutable/SynchronizedStack.java

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg
  • Date: 2015-07-23 12:42:30 UTC
  • Revision ID: package-import@ubuntu.com-20150723124230-2rjvfv6elyn2m7d4
Tags: upstream-5.1.0
ImportĀ upstreamĀ versionĀ 5.1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2014 Goldman Sachs.
 
3
 *
 
4
 * Licensed under the Apache License, Version 2.0 (the "License");
 
5
 * you may not use this file except in compliance with the License.
 
6
 * You may obtain a copy of the License at
 
7
 *
 
8
 *     http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
10
 * Unless required by applicable law or agreed to in writing, software
 
11
 * distributed under the License is distributed on an "AS IS" BASIS,
 
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
 * See the License for the specific language governing permissions and
 
14
 * limitations under the License.
 
15
 */
 
16
 
 
17
package com.gs.collections.impl.stack.mutable;
 
18
 
 
19
import java.io.Serializable;
 
20
import java.util.Collection;
 
21
import java.util.Collections;
 
22
import java.util.Comparator;
 
23
import java.util.Iterator;
 
24
 
 
25
import com.gs.collections.api.LazyIterable;
 
26
import com.gs.collections.api.RichIterable;
 
27
import com.gs.collections.api.bag.MutableBag;
 
28
import com.gs.collections.api.block.function.Function;
 
29
import com.gs.collections.api.block.function.Function0;
 
30
import com.gs.collections.api.block.function.Function2;
 
31
import com.gs.collections.api.block.function.primitive.BooleanFunction;
 
32
import com.gs.collections.api.block.function.primitive.ByteFunction;
 
33
import com.gs.collections.api.block.function.primitive.CharFunction;
 
34
import com.gs.collections.api.block.function.primitive.DoubleFunction;
 
35
import com.gs.collections.api.block.function.primitive.DoubleObjectToDoubleFunction;
 
36
import com.gs.collections.api.block.function.primitive.FloatFunction;
 
37
import com.gs.collections.api.block.function.primitive.FloatObjectToFloatFunction;
 
38
import com.gs.collections.api.block.function.primitive.IntFunction;
 
39
import com.gs.collections.api.block.function.primitive.IntObjectToIntFunction;
 
40
import com.gs.collections.api.block.function.primitive.LongFunction;
 
41
import com.gs.collections.api.block.function.primitive.LongObjectToLongFunction;
 
42
import com.gs.collections.api.block.function.primitive.ShortFunction;
 
43
import com.gs.collections.api.block.predicate.Predicate;
 
44
import com.gs.collections.api.block.predicate.Predicate2;
 
45
import com.gs.collections.api.block.procedure.Procedure;
 
46
import com.gs.collections.api.block.procedure.Procedure2;
 
47
import com.gs.collections.api.block.procedure.primitive.ObjectIntProcedure;
 
48
import com.gs.collections.api.collection.primitive.MutableBooleanCollection;
 
49
import com.gs.collections.api.collection.primitive.MutableByteCollection;
 
50
import com.gs.collections.api.collection.primitive.MutableCharCollection;
 
51
import com.gs.collections.api.collection.primitive.MutableDoubleCollection;
 
52
import com.gs.collections.api.collection.primitive.MutableFloatCollection;
 
53
import com.gs.collections.api.collection.primitive.MutableIntCollection;
 
54
import com.gs.collections.api.collection.primitive.MutableLongCollection;
 
55
import com.gs.collections.api.collection.primitive.MutableShortCollection;
 
56
import com.gs.collections.api.list.ListIterable;
 
57
import com.gs.collections.api.list.MutableList;
 
58
import com.gs.collections.api.map.MutableMap;
 
59
import com.gs.collections.api.map.sorted.MutableSortedMap;
 
60
import com.gs.collections.api.multimap.MutableMultimap;
 
61
import com.gs.collections.api.multimap.list.MutableListMultimap;
 
62
import com.gs.collections.api.partition.stack.PartitionMutableStack;
 
63
import com.gs.collections.api.set.MutableSet;
 
64
import com.gs.collections.api.set.sorted.MutableSortedSet;
 
65
import com.gs.collections.api.stack.ImmutableStack;
 
66
import com.gs.collections.api.stack.MutableStack;
 
67
import com.gs.collections.api.stack.primitive.MutableBooleanStack;
 
68
import com.gs.collections.api.stack.primitive.MutableByteStack;
 
69
import com.gs.collections.api.stack.primitive.MutableCharStack;
 
70
import com.gs.collections.api.stack.primitive.MutableDoubleStack;
 
71
import com.gs.collections.api.stack.primitive.MutableFloatStack;
 
72
import com.gs.collections.api.stack.primitive.MutableIntStack;
 
73
import com.gs.collections.api.stack.primitive.MutableLongStack;
 
74
import com.gs.collections.api.stack.primitive.MutableShortStack;
 
75
import com.gs.collections.api.tuple.Pair;
 
76
import com.gs.collections.impl.UnmodifiableIteratorAdapter;
 
77
import com.gs.collections.impl.block.procedure.MutatingAggregationProcedure;
 
78
import com.gs.collections.impl.block.procedure.NonMutatingAggregationProcedure;
 
79
import com.gs.collections.impl.map.mutable.UnifiedMap;
 
80
 
 
81
/**
 
82
 * A synchronized view of a {@link MutableStack}. It is imperative that the user manually synchronize on the collection when iterating over it using the
 
83
 * standard JDK iterator or JDK 5 for loop, as per {@link Collections#synchronizedCollection(Collection)}.
 
84
 *
 
85
 * @see MutableStack#asSynchronized()
 
86
 */
 
87
public final class SynchronizedStack<T> implements MutableStack<T>, Serializable
 
88
{
 
89
    private static final long serialVersionUID = 1L;
 
90
    private final Object lock;
 
91
    private final MutableStack<T> delegate;
 
92
 
 
93
    public SynchronizedStack(MutableStack<T> newStack)
 
94
    {
 
95
        this(newStack, null);
 
96
    }
 
97
 
 
98
    public SynchronizedStack(MutableStack<T> newStack, Object newLock)
 
99
    {
 
100
        if (newStack == null)
 
101
        {
 
102
            throw new IllegalArgumentException("Cannot create a SynchronizedStack on a null stack");
 
103
        }
 
104
        this.delegate = newStack;
 
105
        this.lock = newLock == null ? this : newLock;
 
106
    }
 
107
 
 
108
    /**
 
109
     * This method will take a MutableStack and wrap it directly in a SynchronizedStack.
 
110
     */
 
111
    public static <T, S extends MutableStack<T>> SynchronizedStack<T> of(S stack)
 
112
    {
 
113
        return new SynchronizedStack<T>(stack);
 
114
    }
 
115
 
 
116
    public T pop()
 
117
    {
 
118
        synchronized (this.lock)
 
119
        {
 
120
            return this.delegate.pop();
 
121
        }
 
122
    }
 
123
 
 
124
    public ListIterable<T> pop(int count)
 
125
    {
 
126
        synchronized (this.lock)
 
127
        {
 
128
            return this.delegate.pop(count);
 
129
        }
 
130
    }
 
131
 
 
132
    public <R extends Collection<T>> R pop(int count, R targetCollection)
 
133
    {
 
134
        synchronized (this.lock)
 
135
        {
 
136
            return this.delegate.pop(count, targetCollection);
 
137
        }
 
138
    }
 
139
 
 
140
    public <R extends MutableStack<T>> R pop(int count, R targetStack)
 
141
    {
 
142
        synchronized (this.lock)
 
143
        {
 
144
            return this.delegate.pop(count, targetStack);
 
145
        }
 
146
    }
 
147
 
 
148
    public void clear()
 
149
    {
 
150
        synchronized (this.lock)
 
151
        {
 
152
            this.delegate.clear();
 
153
        }
 
154
    }
 
155
 
 
156
    public void push(T item)
 
157
    {
 
158
        synchronized (this.lock)
 
159
        {
 
160
            this.delegate.push(item);
 
161
        }
 
162
    }
 
163
 
 
164
    public T peek()
 
165
    {
 
166
        synchronized (this.lock)
 
167
        {
 
168
            return this.delegate.peek();
 
169
        }
 
170
    }
 
171
 
 
172
    public ListIterable<T> peek(int count)
 
173
    {
 
174
        synchronized (this.lock)
 
175
        {
 
176
            return this.delegate.peek(count);
 
177
        }
 
178
    }
 
179
 
 
180
    public T peekAt(int index)
 
181
    {
 
182
        synchronized (this.lock)
 
183
        {
 
184
            return this.delegate.peekAt(index);
 
185
        }
 
186
    }
 
187
 
 
188
    public MutableStack<T> select(Predicate<? super T> predicate)
 
189
    {
 
190
        synchronized (this.lock)
 
191
        {
 
192
            return this.delegate.select(predicate);
 
193
        }
 
194
    }
 
195
 
 
196
    public <P> MutableStack<T> selectWith(Predicate2<? super T, ? super P> predicate, P parameter)
 
197
    {
 
198
        synchronized (this.lock)
 
199
        {
 
200
            return this.delegate.selectWith(predicate, parameter);
 
201
        }
 
202
    }
 
203
 
 
204
    public <R extends Collection<T>> R select(Predicate<? super T> predicate, R target)
 
205
    {
 
206
        synchronized (this.lock)
 
207
        {
 
208
            return this.delegate.select(predicate, target);
 
209
        }
 
210
    }
 
211
 
 
212
    public <P, R extends Collection<T>> R selectWith(Predicate2<? super T, ? super P> predicate, P parameter, R targetCollection)
 
213
    {
 
214
        synchronized (this.lock)
 
215
        {
 
216
            return this.delegate.selectWith(predicate, parameter, targetCollection);
 
217
        }
 
218
    }
 
219
 
 
220
    public MutableStack<T> reject(Predicate<? super T> predicate)
 
221
    {
 
222
        synchronized (this.lock)
 
223
        {
 
224
            return this.delegate.reject(predicate);
 
225
        }
 
226
    }
 
227
 
 
228
    public <P> MutableStack<T> rejectWith(Predicate2<? super T, ? super P> predicate, P parameter)
 
229
    {
 
230
        synchronized (this.lock)
 
231
        {
 
232
            return this.delegate.rejectWith(predicate, parameter);
 
233
        }
 
234
    }
 
235
 
 
236
    public <R extends Collection<T>> R reject(Predicate<? super T> predicate, R target)
 
237
    {
 
238
        synchronized (this.lock)
 
239
        {
 
240
            return this.delegate.reject(predicate, target);
 
241
        }
 
242
    }
 
243
 
 
244
    public <P, R extends Collection<T>> R rejectWith(Predicate2<? super T, ? super P> predicate, P parameter, R targetCollection)
 
245
    {
 
246
        synchronized (this.lock)
 
247
        {
 
248
            return this.delegate.rejectWith(predicate, parameter, targetCollection);
 
249
        }
 
250
    }
 
251
 
 
252
    public PartitionMutableStack<T> partition(Predicate<? super T> predicate)
 
253
    {
 
254
        synchronized (this.lock)
 
255
        {
 
256
            return this.delegate.partition(predicate);
 
257
        }
 
258
    }
 
259
 
 
260
    public <P> PartitionMutableStack<T> partitionWith(Predicate2<? super T, ? super P> predicate, P parameter)
 
261
    {
 
262
        synchronized (this.lock)
 
263
        {
 
264
            return this.delegate.partitionWith(predicate, parameter);
 
265
        }
 
266
    }
 
267
 
 
268
    public <S> RichIterable<S> selectInstancesOf(Class<S> clazz)
 
269
    {
 
270
        synchronized (this.lock)
 
271
        {
 
272
            return this.delegate.selectInstancesOf(clazz);
 
273
        }
 
274
    }
 
275
 
 
276
    public <V> MutableStack<V> collect(Function<? super T, ? extends V> function)
 
277
    {
 
278
        synchronized (this.lock)
 
279
        {
 
280
            return this.delegate.collect(function);
 
281
        }
 
282
    }
 
283
 
 
284
    public MutableBooleanStack collectBoolean(BooleanFunction<? super T> booleanFunction)
 
285
    {
 
286
        synchronized (this.lock)
 
287
        {
 
288
            return this.delegate.collectBoolean(booleanFunction);
 
289
        }
 
290
    }
 
291
 
 
292
    public <R extends MutableBooleanCollection> R collectBoolean(BooleanFunction<? super T> booleanFunction, R target)
 
293
    {
 
294
        synchronized (this.lock)
 
295
        {
 
296
            return this.delegate.collectBoolean(booleanFunction, target);
 
297
        }
 
298
    }
 
299
 
 
300
    public MutableByteStack collectByte(ByteFunction<? super T> byteFunction)
 
301
    {
 
302
        synchronized (this.lock)
 
303
        {
 
304
            return this.delegate.collectByte(byteFunction);
 
305
        }
 
306
    }
 
307
 
 
308
    public <R extends MutableByteCollection> R collectByte(ByteFunction<? super T> byteFunction, R target)
 
309
    {
 
310
        synchronized (this.lock)
 
311
        {
 
312
            return this.delegate.collectByte(byteFunction, target);
 
313
        }
 
314
    }
 
315
 
 
316
    public MutableCharStack collectChar(CharFunction<? super T> charFunction)
 
317
    {
 
318
        synchronized (this.lock)
 
319
        {
 
320
            return this.delegate.collectChar(charFunction);
 
321
        }
 
322
    }
 
323
 
 
324
    public <R extends MutableCharCollection> R collectChar(CharFunction<? super T> charFunction, R target)
 
325
    {
 
326
        synchronized (this.lock)
 
327
        {
 
328
            return this.delegate.collectChar(charFunction, target);
 
329
        }
 
330
    }
 
331
 
 
332
    public MutableDoubleStack collectDouble(DoubleFunction<? super T> doubleFunction)
 
333
    {
 
334
        synchronized (this.lock)
 
335
        {
 
336
            return this.delegate.collectDouble(doubleFunction);
 
337
        }
 
338
    }
 
339
 
 
340
    public <R extends MutableDoubleCollection> R collectDouble(DoubleFunction<? super T> doubleFunction, R target)
 
341
    {
 
342
        synchronized (this.lock)
 
343
        {
 
344
            return this.delegate.collectDouble(doubleFunction, target);
 
345
        }
 
346
    }
 
347
 
 
348
    public MutableFloatStack collectFloat(FloatFunction<? super T> floatFunction)
 
349
    {
 
350
        synchronized (this.lock)
 
351
        {
 
352
            return this.delegate.collectFloat(floatFunction);
 
353
        }
 
354
    }
 
355
 
 
356
    public <R extends MutableFloatCollection> R collectFloat(FloatFunction<? super T> floatFunction, R target)
 
357
    {
 
358
        synchronized (this.lock)
 
359
        {
 
360
            return this.delegate.collectFloat(floatFunction, target);
 
361
        }
 
362
    }
 
363
 
 
364
    public MutableIntStack collectInt(IntFunction<? super T> intFunction)
 
365
    {
 
366
        synchronized (this.lock)
 
367
        {
 
368
            return this.delegate.collectInt(intFunction);
 
369
        }
 
370
    }
 
371
 
 
372
    public <R extends MutableIntCollection> R collectInt(IntFunction<? super T> intFunction, R target)
 
373
    {
 
374
        synchronized (this.lock)
 
375
        {
 
376
            return this.delegate.collectInt(intFunction, target);
 
377
        }
 
378
    }
 
379
 
 
380
    public MutableLongStack collectLong(LongFunction<? super T> longFunction)
 
381
    {
 
382
        synchronized (this.lock)
 
383
        {
 
384
            return this.delegate.collectLong(longFunction);
 
385
        }
 
386
    }
 
387
 
 
388
    public <R extends MutableLongCollection> R collectLong(LongFunction<? super T> longFunction, R target)
 
389
    {
 
390
        synchronized (this.lock)
 
391
        {
 
392
            return this.delegate.collectLong(longFunction, target);
 
393
        }
 
394
    }
 
395
 
 
396
    public MutableShortStack collectShort(ShortFunction<? super T> shortFunction)
 
397
    {
 
398
        synchronized (this.lock)
 
399
        {
 
400
            return this.delegate.collectShort(shortFunction);
 
401
        }
 
402
    }
 
403
 
 
404
    public <R extends MutableShortCollection> R collectShort(ShortFunction<? super T> shortFunction, R target)
 
405
    {
 
406
        synchronized (this.lock)
 
407
        {
 
408
            return this.delegate.collectShort(shortFunction, target);
 
409
        }
 
410
    }
 
411
 
 
412
    public <V, R extends Collection<V>> R collect(Function<? super T, ? extends V> function, R target)
 
413
    {
 
414
        synchronized (this.lock)
 
415
        {
 
416
            return this.delegate.collect(function, target);
 
417
        }
 
418
    }
 
419
 
 
420
    public <P, V> MutableStack<V> collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter)
 
421
    {
 
422
        synchronized (this.lock)
 
423
        {
 
424
            return this.delegate.collectWith(function, parameter);
 
425
        }
 
426
    }
 
427
 
 
428
    public <P, V, R extends Collection<V>> R collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter, R targetCollection)
 
429
    {
 
430
        synchronized (this.lock)
 
431
        {
 
432
            return this.delegate.collectWith(function, parameter, targetCollection);
 
433
        }
 
434
    }
 
435
 
 
436
    public <V> MutableStack<V> collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function)
 
437
    {
 
438
        synchronized (this.lock)
 
439
        {
 
440
            return this.delegate.collectIf(predicate, function);
 
441
        }
 
442
    }
 
443
 
 
444
    public <V, R extends Collection<V>> R collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function, R target)
 
445
    {
 
446
        synchronized (this.lock)
 
447
        {
 
448
            return this.delegate.collectIf(predicate, function, target);
 
449
        }
 
450
    }
 
451
 
 
452
    public <V> MutableStack<V> flatCollect(Function<? super T, ? extends Iterable<V>> function)
 
453
    {
 
454
        synchronized (this.lock)
 
455
        {
 
456
            return this.delegate.flatCollect(function);
 
457
        }
 
458
    }
 
459
 
 
460
    public <V, R extends Collection<V>> R flatCollect(Function<? super T, ? extends Iterable<V>> function, R target)
 
461
    {
 
462
        synchronized (this.lock)
 
463
        {
 
464
            return this.delegate.flatCollect(function, target);
 
465
        }
 
466
    }
 
467
 
 
468
    public <S, R extends Collection<Pair<T, S>>> R zip(Iterable<S> that, R target)
 
469
    {
 
470
        synchronized (this.lock)
 
471
        {
 
472
            return this.delegate.zip(that, target);
 
473
        }
 
474
    }
 
475
 
 
476
    public <S> MutableStack<Pair<T, S>> zip(Iterable<S> that)
 
477
    {
 
478
        synchronized (this.lock)
 
479
        {
 
480
            return this.delegate.zip(that);
 
481
        }
 
482
    }
 
483
 
 
484
    public <R extends Collection<Pair<T, Integer>>> R zipWithIndex(R target)
 
485
    {
 
486
        synchronized (this.lock)
 
487
        {
 
488
            return this.delegate.zipWithIndex(target);
 
489
        }
 
490
    }
 
491
 
 
492
    public MutableStack<Pair<T, Integer>> zipWithIndex()
 
493
    {
 
494
        synchronized (this.lock)
 
495
        {
 
496
            return this.delegate.zipWithIndex();
 
497
        }
 
498
    }
 
499
 
 
500
    public int size()
 
501
    {
 
502
        synchronized (this.lock)
 
503
        {
 
504
            return this.delegate.size();
 
505
        }
 
506
    }
 
507
 
 
508
    public boolean isEmpty()
 
509
    {
 
510
        synchronized (this.lock)
 
511
        {
 
512
            return this.delegate.isEmpty();
 
513
        }
 
514
    }
 
515
 
 
516
    public boolean notEmpty()
 
517
    {
 
518
        synchronized (this.lock)
 
519
        {
 
520
            return this.delegate.notEmpty();
 
521
        }
 
522
    }
 
523
 
 
524
    public T getFirst()
 
525
    {
 
526
        synchronized (this.lock)
 
527
        {
 
528
            return this.delegate.getFirst();
 
529
        }
 
530
    }
 
531
 
 
532
    public T getLast()
 
533
    {
 
534
        return this.delegate.getLast();
 
535
    }
 
536
 
 
537
    public boolean contains(Object object)
 
538
    {
 
539
        synchronized (this.lock)
 
540
        {
 
541
            return this.delegate.contains(object);
 
542
        }
 
543
    }
 
544
 
 
545
    public boolean containsAllIterable(Iterable<?> source)
 
546
    {
 
547
        synchronized (this.lock)
 
548
        {
 
549
            return this.delegate.containsAllIterable(source);
 
550
        }
 
551
    }
 
552
 
 
553
    public boolean containsAll(Collection<?> source)
 
554
    {
 
555
        synchronized (this.lock)
 
556
        {
 
557
            return this.delegate.containsAll(source);
 
558
        }
 
559
    }
 
560
 
 
561
    public boolean containsAllArguments(Object... elements)
 
562
    {
 
563
        synchronized (this.lock)
 
564
        {
 
565
            return this.delegate.containsAllArguments(elements);
 
566
        }
 
567
    }
 
568
 
 
569
    public T detect(Predicate<? super T> predicate)
 
570
    {
 
571
        synchronized (this.lock)
 
572
        {
 
573
            return this.delegate.detect(predicate);
 
574
        }
 
575
    }
 
576
 
 
577
    public <P> T detectWith(Predicate2<? super T, ? super P> predicate, P parameter)
 
578
    {
 
579
        synchronized (this.lock)
 
580
        {
 
581
            return this.delegate.detectWith(predicate, parameter);
 
582
        }
 
583
    }
 
584
 
 
585
    public T detectIfNone(Predicate<? super T> predicate, Function0<? extends T> function)
 
586
    {
 
587
        synchronized (this.lock)
 
588
        {
 
589
            return this.delegate.detectIfNone(predicate, function);
 
590
        }
 
591
    }
 
592
 
 
593
    public <P> T detectWithIfNone(Predicate2<? super T, ? super P> predicate, P parameter, Function0<? extends T> function)
 
594
    {
 
595
        synchronized (this.lock)
 
596
        {
 
597
            return this.delegate.detectWithIfNone(predicate, parameter, function);
 
598
        }
 
599
    }
 
600
 
 
601
    public int count(Predicate<? super T> predicate)
 
602
    {
 
603
        synchronized (this.lock)
 
604
        {
 
605
            return this.delegate.count(predicate);
 
606
        }
 
607
    }
 
608
 
 
609
    public <P> int countWith(Predicate2<? super T, ? super P> predicate, P parameter)
 
610
    {
 
611
        synchronized (this.lock)
 
612
        {
 
613
            return this.delegate.countWith(predicate, parameter);
 
614
        }
 
615
    }
 
616
 
 
617
    public boolean anySatisfy(Predicate<? super T> predicate)
 
618
    {
 
619
        synchronized (this.lock)
 
620
        {
 
621
            return this.delegate.anySatisfy(predicate);
 
622
        }
 
623
    }
 
624
 
 
625
    public <P> boolean anySatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)
 
626
    {
 
627
        synchronized (this.lock)
 
628
        {
 
629
            return this.delegate.anySatisfyWith(predicate, parameter);
 
630
        }
 
631
    }
 
632
 
 
633
    public boolean allSatisfy(Predicate<? super T> predicate)
 
634
    {
 
635
        synchronized (this.lock)
 
636
        {
 
637
            return this.delegate.allSatisfy(predicate);
 
638
        }
 
639
    }
 
640
 
 
641
    public <P> boolean allSatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)
 
642
    {
 
643
        synchronized (this.lock)
 
644
        {
 
645
            return this.delegate.allSatisfyWith(predicate, parameter);
 
646
        }
 
647
    }
 
648
 
 
649
    public boolean noneSatisfy(Predicate<? super T> predicate)
 
650
    {
 
651
        synchronized (this.lock)
 
652
        {
 
653
            return this.delegate.noneSatisfy(predicate);
 
654
        }
 
655
    }
 
656
 
 
657
    public <P> boolean noneSatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)
 
658
    {
 
659
        synchronized (this.lock)
 
660
        {
 
661
            return this.delegate.noneSatisfyWith(predicate, parameter);
 
662
        }
 
663
    }
 
664
 
 
665
    public <IV> IV injectInto(IV injectedValue, Function2<? super IV, ? super T, ? extends IV> function)
 
666
    {
 
667
        synchronized (this.lock)
 
668
        {
 
669
            return this.delegate.injectInto(injectedValue, function);
 
670
        }
 
671
    }
 
672
 
 
673
    public int injectInto(int injectedValue, IntObjectToIntFunction<? super T> intObjectToIntFunction)
 
674
    {
 
675
        synchronized (this.lock)
 
676
        {
 
677
            return this.delegate.injectInto(injectedValue, intObjectToIntFunction);
 
678
        }
 
679
    }
 
680
 
 
681
    public long injectInto(long injectedValue, LongObjectToLongFunction<? super T> longObjectToLongFunction)
 
682
    {
 
683
        synchronized (this.lock)
 
684
        {
 
685
            return this.delegate.injectInto(injectedValue, longObjectToLongFunction);
 
686
        }
 
687
    }
 
688
 
 
689
    public float injectInto(float injectedValue, FloatObjectToFloatFunction<? super T> floatObjectToFloatFunction)
 
690
    {
 
691
        synchronized (this.lock)
 
692
        {
 
693
            return this.delegate.injectInto(injectedValue, floatObjectToFloatFunction);
 
694
        }
 
695
    }
 
696
 
 
697
    public double injectInto(double injectedValue, DoubleObjectToDoubleFunction<? super T> doubleObjectToDoubleFunction)
 
698
    {
 
699
        synchronized (this.lock)
 
700
        {
 
701
            return this.delegate.injectInto(injectedValue, doubleObjectToDoubleFunction);
 
702
        }
 
703
    }
 
704
 
 
705
    public MutableList<T> toList()
 
706
    {
 
707
        synchronized (this.lock)
 
708
        {
 
709
            return this.delegate.toList();
 
710
        }
 
711
    }
 
712
 
 
713
    public MutableList<T> toSortedList()
 
714
    {
 
715
        synchronized (this.lock)
 
716
        {
 
717
            return this.delegate.toSortedList();
 
718
        }
 
719
    }
 
720
 
 
721
    public MutableList<T> toSortedList(Comparator<? super T> comparator)
 
722
    {
 
723
        synchronized (this.lock)
 
724
        {
 
725
            return this.delegate.toSortedList(comparator);
 
726
        }
 
727
    }
 
728
 
 
729
    public <V extends Comparable<? super V>> MutableList<T> toSortedListBy(Function<? super T, ? extends V> function)
 
730
    {
 
731
        synchronized (this.lock)
 
732
        {
 
733
            return this.delegate.toSortedListBy(function);
 
734
        }
 
735
    }
 
736
 
 
737
    public MutableSet<T> toSet()
 
738
    {
 
739
        synchronized (this.lock)
 
740
        {
 
741
            return this.delegate.toSet();
 
742
        }
 
743
    }
 
744
 
 
745
    public MutableSortedSet<T> toSortedSet()
 
746
    {
 
747
        synchronized (this.lock)
 
748
        {
 
749
            return this.delegate.toSortedSet();
 
750
        }
 
751
    }
 
752
 
 
753
    public MutableSortedSet<T> toSortedSet(Comparator<? super T> comparator)
 
754
    {
 
755
        synchronized (this.lock)
 
756
        {
 
757
            return this.delegate.toSortedSet(comparator);
 
758
        }
 
759
    }
 
760
 
 
761
    public MutableStack<T> toStack()
 
762
    {
 
763
        synchronized (this.lock)
 
764
        {
 
765
            return this.delegate.toStack();
 
766
        }
 
767
    }
 
768
 
 
769
    public ImmutableStack<T> toImmutable()
 
770
    {
 
771
        synchronized (this.lock)
 
772
        {
 
773
            return this.delegate.toImmutable();
 
774
        }
 
775
    }
 
776
 
 
777
    public <V extends Comparable<? super V>> MutableSortedSet<T> toSortedSetBy(Function<? super T, ? extends V> function)
 
778
    {
 
779
        synchronized (this.lock)
 
780
        {
 
781
            return this.delegate.toSortedSetBy(function);
 
782
        }
 
783
    }
 
784
 
 
785
    public MutableBag<T> toBag()
 
786
    {
 
787
        synchronized (this.lock)
 
788
        {
 
789
            return this.delegate.toBag();
 
790
        }
 
791
    }
 
792
 
 
793
    public <NK, NV> MutableMap<NK, NV> toMap(Function<? super T, ? extends NK> keyFunction, Function<? super T, ? extends NV> valueFunction)
 
794
    {
 
795
        synchronized (this.lock)
 
796
        {
 
797
            return this.delegate.toMap(keyFunction, valueFunction);
 
798
        }
 
799
    }
 
800
 
 
801
    public <NK, NV> MutableSortedMap<NK, NV> toSortedMap(Function<? super T, ? extends NK> keyFunction, Function<? super T, ? extends NV> valueFunction)
 
802
    {
 
803
        synchronized (this.lock)
 
804
        {
 
805
            return this.delegate.toSortedMap(keyFunction, valueFunction);
 
806
        }
 
807
    }
 
808
 
 
809
    public <NK, NV> MutableSortedMap<NK, NV> toSortedMap(Comparator<? super NK> comparator, Function<? super T, ? extends NK> keyFunction, Function<? super T, ? extends NV> valueFunction)
 
810
    {
 
811
        synchronized (this.lock)
 
812
        {
 
813
            return this.delegate.toSortedMap(comparator, keyFunction, valueFunction);
 
814
        }
 
815
    }
 
816
 
 
817
    public LazyIterable<T> asLazy()
 
818
    {
 
819
        synchronized (this.lock)
 
820
        {
 
821
            return this.delegate.asLazy();
 
822
        }
 
823
    }
 
824
 
 
825
    public Object[] toArray()
 
826
    {
 
827
        synchronized (this.lock)
 
828
        {
 
829
            return this.delegate.toArray();
 
830
        }
 
831
    }
 
832
 
 
833
    public <T> T[] toArray(T[] a)
 
834
    {
 
835
        synchronized (this.lock)
 
836
        {
 
837
            return this.delegate.toArray(a);
 
838
        }
 
839
    }
 
840
 
 
841
    public T min(Comparator<? super T> comparator)
 
842
    {
 
843
        synchronized (this.lock)
 
844
        {
 
845
            return this.delegate.min(comparator);
 
846
        }
 
847
    }
 
848
 
 
849
    public T max(Comparator<? super T> comparator)
 
850
    {
 
851
        synchronized (this.lock)
 
852
        {
 
853
            return this.delegate.max(comparator);
 
854
        }
 
855
    }
 
856
 
 
857
    public T min()
 
858
    {
 
859
        synchronized (this.lock)
 
860
        {
 
861
            return this.delegate.min();
 
862
        }
 
863
    }
 
864
 
 
865
    public T max()
 
866
    {
 
867
        synchronized (this.lock)
 
868
        {
 
869
            return this.delegate.max();
 
870
        }
 
871
    }
 
872
 
 
873
    public <V extends Comparable<? super V>> T minBy(Function<? super T, ? extends V> function)
 
874
    {
 
875
        synchronized (this.lock)
 
876
        {
 
877
            return this.delegate.minBy(function);
 
878
        }
 
879
    }
 
880
 
 
881
    public <V extends Comparable<? super V>> T maxBy(Function<? super T, ? extends V> function)
 
882
    {
 
883
        synchronized (this.lock)
 
884
        {
 
885
            return this.delegate.maxBy(function);
 
886
        }
 
887
    }
 
888
 
 
889
    public long sumOfInt(IntFunction<? super T> intFunction)
 
890
    {
 
891
        synchronized (this.lock)
 
892
        {
 
893
            return this.delegate.sumOfInt(intFunction);
 
894
        }
 
895
    }
 
896
 
 
897
    public double sumOfFloat(FloatFunction<? super T> floatFunction)
 
898
    {
 
899
        synchronized (this.lock)
 
900
        {
 
901
            return this.delegate.sumOfFloat(floatFunction);
 
902
        }
 
903
    }
 
904
 
 
905
    public long sumOfLong(LongFunction<? super T> longFunction)
 
906
    {
 
907
        synchronized (this.lock)
 
908
        {
 
909
            return this.delegate.sumOfLong(longFunction);
 
910
        }
 
911
    }
 
912
 
 
913
    public double sumOfDouble(DoubleFunction<? super T> doubleFunction)
 
914
    {
 
915
        synchronized (this.lock)
 
916
        {
 
917
            return this.delegate.sumOfDouble(doubleFunction);
 
918
        }
 
919
    }
 
920
 
 
921
    public String makeString()
 
922
    {
 
923
        synchronized (this.lock)
 
924
        {
 
925
            return this.delegate.makeString();
 
926
        }
 
927
    }
 
928
 
 
929
    public String makeString(String separator)
 
930
    {
 
931
        synchronized (this.lock)
 
932
        {
 
933
            return this.delegate.makeString(separator);
 
934
        }
 
935
    }
 
936
 
 
937
    public String makeString(String start, String separator, String end)
 
938
    {
 
939
        synchronized (this.lock)
 
940
        {
 
941
            return this.delegate.makeString(start, separator, end);
 
942
        }
 
943
    }
 
944
 
 
945
    public void appendString(Appendable appendable)
 
946
    {
 
947
        synchronized (this.lock)
 
948
        {
 
949
            this.delegate.appendString(appendable);
 
950
        }
 
951
    }
 
952
 
 
953
    public void appendString(Appendable appendable, String separator)
 
954
    {
 
955
        synchronized (this.lock)
 
956
        {
 
957
            this.delegate.appendString(appendable, separator);
 
958
        }
 
959
    }
 
960
 
 
961
    public void appendString(Appendable appendable, String start, String separator, String end)
 
962
    {
 
963
        synchronized (this.lock)
 
964
        {
 
965
            this.delegate.appendString(appendable, start, separator, end);
 
966
        }
 
967
    }
 
968
 
 
969
    public <V> MutableListMultimap<V, T> groupBy(Function<? super T, ? extends V> function)
 
970
    {
 
971
        synchronized (this.lock)
 
972
        {
 
973
            return this.delegate.groupBy(function);
 
974
        }
 
975
    }
 
976
 
 
977
    public <V, R extends MutableMultimap<V, T>> R groupBy(Function<? super T, ? extends V> function, R target)
 
978
    {
 
979
        synchronized (this.lock)
 
980
        {
 
981
            return this.delegate.groupBy(function, target);
 
982
        }
 
983
    }
 
984
 
 
985
    public <V> MutableListMultimap<V, T> groupByEach(Function<? super T, ? extends Iterable<V>> function)
 
986
    {
 
987
        synchronized (this.lock)
 
988
        {
 
989
            return this.delegate.groupByEach(function);
 
990
        }
 
991
    }
 
992
 
 
993
    public <V, R extends MutableMultimap<V, T>> R groupByEach(Function<? super T, ? extends Iterable<V>> function, R target)
 
994
    {
 
995
        synchronized (this.lock)
 
996
        {
 
997
            return this.delegate.groupByEach(function, target);
 
998
        }
 
999
    }
 
1000
 
 
1001
    public <V> MutableMap<V, T> groupByUniqueKey(Function<? super T, ? extends V> function)
 
1002
    {
 
1003
        synchronized (this.lock)
 
1004
        {
 
1005
            return this.delegate.groupByUniqueKey(function);
 
1006
        }
 
1007
    }
 
1008
 
 
1009
    public RichIterable<RichIterable<T>> chunk(int size)
 
1010
    {
 
1011
        synchronized (this.lock)
 
1012
        {
 
1013
            return this.delegate.chunk(size);
 
1014
        }
 
1015
    }
 
1016
 
 
1017
    public void forEach(Procedure<? super T> procedure)
 
1018
    {
 
1019
        synchronized (this.lock)
 
1020
        {
 
1021
            this.delegate.forEach(procedure);
 
1022
        }
 
1023
    }
 
1024
 
 
1025
    @Override
 
1026
    public String toString()
 
1027
    {
 
1028
        synchronized (this.lock)
 
1029
        {
 
1030
            return this.delegate.toString();
 
1031
        }
 
1032
    }
 
1033
 
 
1034
    public void forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)
 
1035
    {
 
1036
        synchronized (this.lock)
 
1037
        {
 
1038
            this.delegate.forEachWithIndex(objectIntProcedure);
 
1039
        }
 
1040
    }
 
1041
 
 
1042
    public <P> void forEachWith(Procedure2<? super T, ? super P> procedure, P parameter)
 
1043
    {
 
1044
        synchronized (this.lock)
 
1045
        {
 
1046
            this.delegate.forEachWith(procedure, parameter);
 
1047
        }
 
1048
    }
 
1049
 
 
1050
    public MutableStack<T> asUnmodifiable()
 
1051
    {
 
1052
        synchronized (this.lock)
 
1053
        {
 
1054
            return this.delegate.asUnmodifiable();
 
1055
        }
 
1056
    }
 
1057
 
 
1058
    @Override
 
1059
    public boolean equals(Object obj)
 
1060
    {
 
1061
        synchronized (this.lock)
 
1062
        {
 
1063
            return this.delegate.equals(obj);
 
1064
        }
 
1065
    }
 
1066
 
 
1067
    @Override
 
1068
    public int hashCode()
 
1069
    {
 
1070
        synchronized (this.lock)
 
1071
        {
 
1072
            return this.delegate.hashCode();
 
1073
        }
 
1074
    }
 
1075
 
 
1076
    public MutableStack<T> asSynchronized()
 
1077
    {
 
1078
        synchronized (this.lock)
 
1079
        {
 
1080
            return this;
 
1081
        }
 
1082
    }
 
1083
 
 
1084
    public Iterator<T> iterator()
 
1085
    {
 
1086
        return new UnmodifiableIteratorAdapter<T>(this.delegate.iterator());
 
1087
    }
 
1088
 
 
1089
    public <K, V> MutableMap<K, V> aggregateInPlaceBy(
 
1090
            Function<? super T, ? extends K> groupBy,
 
1091
            Function0<? extends V> zeroValueFactory,
 
1092
            Procedure2<? super V, ? super T> mutatingAggregator)
 
1093
    {
 
1094
        MutableMap<K, V> map = UnifiedMap.newMap();
 
1095
        this.forEach(new MutatingAggregationProcedure<T, K, V>(map, groupBy, zeroValueFactory, mutatingAggregator));
 
1096
        return map;
 
1097
    }
 
1098
 
 
1099
    public <K, V> MutableMap<K, V> aggregateBy(
 
1100
            Function<? super T, ? extends K> groupBy,
 
1101
            Function0<? extends V> zeroValueFactory,
 
1102
            Function2<? super V, ? super T, ? extends V> nonMutatingAggregator)
 
1103
    {
 
1104
        MutableMap<K, V> map = UnifiedMap.newMap();
 
1105
        this.forEach(new NonMutatingAggregationProcedure<T, K, V>(map, groupBy, zeroValueFactory, nonMutatingAggregator));
 
1106
        return map;
 
1107
    }
 
1108
}