~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/map/SynchronizedMapIterable.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.map;
 
18
 
 
19
import java.io.Serializable;
 
20
import java.util.Collection;
 
21
import java.util.Comparator;
 
22
import java.util.Iterator;
 
23
 
 
24
import com.gs.collections.api.LazyIterable;
 
25
import com.gs.collections.api.RichIterable;
 
26
import com.gs.collections.api.bag.MutableBag;
 
27
import com.gs.collections.api.block.function.Function;
 
28
import com.gs.collections.api.block.function.Function0;
 
29
import com.gs.collections.api.block.function.Function2;
 
30
import com.gs.collections.api.block.function.primitive.BooleanFunction;
 
31
import com.gs.collections.api.block.function.primitive.ByteFunction;
 
32
import com.gs.collections.api.block.function.primitive.CharFunction;
 
33
import com.gs.collections.api.block.function.primitive.DoubleFunction;
 
34
import com.gs.collections.api.block.function.primitive.DoubleObjectToDoubleFunction;
 
35
import com.gs.collections.api.block.function.primitive.FloatFunction;
 
36
import com.gs.collections.api.block.function.primitive.FloatObjectToFloatFunction;
 
37
import com.gs.collections.api.block.function.primitive.IntFunction;
 
38
import com.gs.collections.api.block.function.primitive.IntObjectToIntFunction;
 
39
import com.gs.collections.api.block.function.primitive.LongFunction;
 
40
import com.gs.collections.api.block.function.primitive.LongObjectToLongFunction;
 
41
import com.gs.collections.api.block.function.primitive.ShortFunction;
 
42
import com.gs.collections.api.block.predicate.Predicate;
 
43
import com.gs.collections.api.block.predicate.Predicate2;
 
44
import com.gs.collections.api.block.procedure.Procedure;
 
45
import com.gs.collections.api.block.procedure.Procedure2;
 
46
import com.gs.collections.api.block.procedure.primitive.ObjectIntProcedure;
 
47
import com.gs.collections.api.collection.primitive.MutableBooleanCollection;
 
48
import com.gs.collections.api.collection.primitive.MutableByteCollection;
 
49
import com.gs.collections.api.collection.primitive.MutableCharCollection;
 
50
import com.gs.collections.api.collection.primitive.MutableDoubleCollection;
 
51
import com.gs.collections.api.collection.primitive.MutableFloatCollection;
 
52
import com.gs.collections.api.collection.primitive.MutableIntCollection;
 
53
import com.gs.collections.api.collection.primitive.MutableLongCollection;
 
54
import com.gs.collections.api.collection.primitive.MutableShortCollection;
 
55
import com.gs.collections.api.list.MutableList;
 
56
import com.gs.collections.api.map.MapIterable;
 
57
import com.gs.collections.api.map.MutableMap;
 
58
import com.gs.collections.api.map.sorted.MutableSortedMap;
 
59
import com.gs.collections.api.multimap.MutableMultimap;
 
60
import com.gs.collections.api.set.MutableSet;
 
61
import com.gs.collections.api.set.sorted.MutableSortedSet;
 
62
import com.gs.collections.api.tuple.Pair;
 
63
 
 
64
/**
 
65
 * A synchronized view of a map.
 
66
 */
 
67
public abstract class SynchronizedMapIterable<K, V>
 
68
        implements MapIterable<K, V>, Serializable
 
69
{
 
70
    private static final long serialVersionUID = 1L;
 
71
 
 
72
    protected final Object lock;
 
73
    private final MapIterable<K, V> mapIterable;
 
74
 
 
75
    protected SynchronizedMapIterable(MapIterable<K, V> newMap)
 
76
    {
 
77
        this(newMap, null);
 
78
    }
 
79
 
 
80
    protected SynchronizedMapIterable(MapIterable<K, V> newMap, Object newLock)
 
81
    {
 
82
        if (newMap == null)
 
83
        {
 
84
            throw new IllegalArgumentException("Cannot create a SynchronizedMapIterable on a null map");
 
85
        }
 
86
        this.mapIterable = newMap;
 
87
        this.lock = newLock == null ? this : newLock;
 
88
    }
 
89
 
 
90
    protected MapIterable<K, V> getMap()
 
91
    {
 
92
        return this.mapIterable;
 
93
    }
 
94
 
 
95
    public V get(Object key)
 
96
    {
 
97
        synchronized (this.lock)
 
98
        {
 
99
            return this.mapIterable.get(key);
 
100
        }
 
101
    }
 
102
 
 
103
    public boolean containsKey(Object key)
 
104
    {
 
105
        synchronized (this.lock)
 
106
        {
 
107
            return this.mapIterable.containsKey(key);
 
108
        }
 
109
    }
 
110
 
 
111
    public boolean containsValue(Object value)
 
112
    {
 
113
        synchronized (this.lock)
 
114
        {
 
115
            return this.mapIterable.containsValue(value);
 
116
        }
 
117
    }
 
118
 
 
119
    public void forEachValue(Procedure<? super V> procedure)
 
120
    {
 
121
        synchronized (this.lock)
 
122
        {
 
123
            this.mapIterable.forEachValue(procedure);
 
124
        }
 
125
    }
 
126
 
 
127
    public void forEachKey(Procedure<? super K> procedure)
 
128
    {
 
129
        synchronized (this.lock)
 
130
        {
 
131
            this.mapIterable.forEachKey(procedure);
 
132
        }
 
133
    }
 
134
 
 
135
    public void forEachKeyValue(Procedure2<? super K, ? super V> procedure2)
 
136
    {
 
137
        synchronized (this.lock)
 
138
        {
 
139
            this.mapIterable.forEachKeyValue(procedure2);
 
140
        }
 
141
    }
 
142
 
 
143
    public V getIfAbsent(K key, Function0<? extends V> function)
 
144
    {
 
145
        synchronized (this.lock)
 
146
        {
 
147
            return this.mapIterable.getIfAbsent(key, function);
 
148
        }
 
149
    }
 
150
 
 
151
    public V getIfAbsentValue(K key, V value)
 
152
    {
 
153
        synchronized (this.lock)
 
154
        {
 
155
            return this.mapIterable.getIfAbsentValue(key, value);
 
156
        }
 
157
    }
 
158
 
 
159
    public <P> V getIfAbsentWith(K key, Function<? super P, ? extends V> function, P parameter)
 
160
    {
 
161
        synchronized (this.lock)
 
162
        {
 
163
            return this.mapIterable.getIfAbsentWith(key, function, parameter);
 
164
        }
 
165
    }
 
166
 
 
167
    public <A> A ifPresentApply(K key, Function<? super V, ? extends A> function)
 
168
    {
 
169
        synchronized (this.lock)
 
170
        {
 
171
            return this.mapIterable.ifPresentApply(key, function);
 
172
        }
 
173
    }
 
174
 
 
175
    public Pair<K, V> detect(Predicate2<? super K, ? super V> predicate)
 
176
    {
 
177
        synchronized (this.lock)
 
178
        {
 
179
            return this.mapIterable.detect(predicate);
 
180
        }
 
181
    }
 
182
 
 
183
    public int size()
 
184
    {
 
185
        synchronized (this.lock)
 
186
        {
 
187
            return this.mapIterable.size();
 
188
        }
 
189
    }
 
190
 
 
191
    public boolean isEmpty()
 
192
    {
 
193
        synchronized (this.lock)
 
194
        {
 
195
            return this.mapIterable.isEmpty();
 
196
        }
 
197
    }
 
198
 
 
199
    public boolean notEmpty()
 
200
    {
 
201
        synchronized (this.lock)
 
202
        {
 
203
            return this.mapIterable.notEmpty();
 
204
        }
 
205
    }
 
206
 
 
207
    public V getFirst()
 
208
    {
 
209
        synchronized (this.lock)
 
210
        {
 
211
            return this.mapIterable.getFirst();
 
212
        }
 
213
    }
 
214
 
 
215
    public V getLast()
 
216
    {
 
217
        synchronized (this.lock)
 
218
        {
 
219
            return this.mapIterable.getLast();
 
220
        }
 
221
    }
 
222
 
 
223
    public boolean contains(Object object)
 
224
    {
 
225
        synchronized (this.lock)
 
226
        {
 
227
            return this.mapIterable.contains(object);
 
228
        }
 
229
    }
 
230
 
 
231
    public boolean containsAllIterable(Iterable<?> source)
 
232
    {
 
233
        synchronized (this.lock)
 
234
        {
 
235
            return this.mapIterable.containsAllIterable(source);
 
236
        }
 
237
    }
 
238
 
 
239
    public boolean containsAll(Collection<?> source)
 
240
    {
 
241
        synchronized (this.lock)
 
242
        {
 
243
            return this.mapIterable.containsAll(source);
 
244
        }
 
245
    }
 
246
 
 
247
    public boolean containsAllArguments(Object... elements)
 
248
    {
 
249
        synchronized (this.lock)
 
250
        {
 
251
            return this.mapIterable.containsAllArguments(elements);
 
252
        }
 
253
    }
 
254
 
 
255
    public <R extends Collection<V>> R select(Predicate<? super V> predicate, R target)
 
256
    {
 
257
        synchronized (this.lock)
 
258
        {
 
259
            return this.mapIterable.select(predicate, target);
 
260
        }
 
261
    }
 
262
 
 
263
    public <P> RichIterable<V> selectWith(Predicate2<? super V, ? super P> predicate, P parameter)
 
264
    {
 
265
        synchronized (this.lock)
 
266
        {
 
267
            return this.mapIterable.selectWith(predicate, parameter);
 
268
        }
 
269
    }
 
270
 
 
271
    public <P, R extends Collection<V>> R selectWith(Predicate2<? super V, ? super P> predicate, P parameter, R targetCollection)
 
272
    {
 
273
        synchronized (this.lock)
 
274
        {
 
275
            return this.mapIterable.selectWith(predicate, parameter, targetCollection);
 
276
        }
 
277
    }
 
278
 
 
279
    public <R extends Collection<V>> R reject(Predicate<? super V> predicate, R target)
 
280
    {
 
281
        synchronized (this.lock)
 
282
        {
 
283
            return this.mapIterable.reject(predicate, target);
 
284
        }
 
285
    }
 
286
 
 
287
    public <P> RichIterable<V> rejectWith(Predicate2<? super V, ? super P> predicate, P parameter)
 
288
    {
 
289
        synchronized (this.lock)
 
290
        {
 
291
            return this.mapIterable.rejectWith(predicate, parameter);
 
292
        }
 
293
    }
 
294
 
 
295
    public <P, R extends Collection<V>> R rejectWith(Predicate2<? super V, ? super P> predicate, P parameter, R targetCollection)
 
296
    {
 
297
        synchronized (this.lock)
 
298
        {
 
299
            return this.mapIterable.rejectWith(predicate, parameter, targetCollection);
 
300
        }
 
301
    }
 
302
 
 
303
    public V detect(Predicate<? super V> predicate)
 
304
    {
 
305
        synchronized (this.lock)
 
306
        {
 
307
            return this.mapIterable.detect(predicate);
 
308
        }
 
309
    }
 
310
 
 
311
    public <P> V detectWith(Predicate2<? super V, ? super P> predicate, P parameter)
 
312
    {
 
313
        synchronized (this.lock)
 
314
        {
 
315
            return this.mapIterable.detectWith(predicate, parameter);
 
316
        }
 
317
    }
 
318
 
 
319
    public V detectIfNone(Predicate<? super V> predicate, Function0<? extends V> function)
 
320
    {
 
321
        synchronized (this.lock)
 
322
        {
 
323
            return this.mapIterable.detectIfNone(predicate, function);
 
324
        }
 
325
    }
 
326
 
 
327
    public <P> V detectWithIfNone(Predicate2<? super V, ? super P> predicate, P parameter, Function0<? extends V> function)
 
328
    {
 
329
        synchronized (this.lock)
 
330
        {
 
331
            return this.mapIterable.detectWithIfNone(predicate, parameter, function);
 
332
        }
 
333
    }
 
334
 
 
335
    public int count(Predicate<? super V> predicate)
 
336
    {
 
337
        synchronized (this.lock)
 
338
        {
 
339
            return this.mapIterable.count(predicate);
 
340
        }
 
341
    }
 
342
 
 
343
    public <P> int countWith(Predicate2<? super V, ? super P> predicate, P parameter)
 
344
    {
 
345
        synchronized (this.lock)
 
346
        {
 
347
            return this.mapIterable.countWith(predicate, parameter);
 
348
        }
 
349
    }
 
350
 
 
351
    public boolean anySatisfy(Predicate<? super V> predicate)
 
352
    {
 
353
        synchronized (this.lock)
 
354
        {
 
355
            return this.mapIterable.anySatisfy(predicate);
 
356
        }
 
357
    }
 
358
 
 
359
    public boolean allSatisfy(Predicate<? super V> predicate)
 
360
    {
 
361
        synchronized (this.lock)
 
362
        {
 
363
            return this.mapIterable.allSatisfy(predicate);
 
364
        }
 
365
    }
 
366
 
 
367
    public boolean noneSatisfy(Predicate<? super V> predicate)
 
368
    {
 
369
        synchronized (this.lock)
 
370
        {
 
371
            return this.mapIterable.noneSatisfy(predicate);
 
372
        }
 
373
    }
 
374
 
 
375
    public <P> boolean anySatisfyWith(Predicate2<? super V, ? super P> predicate, P parameter)
 
376
    {
 
377
        synchronized (this.lock)
 
378
        {
 
379
            return this.mapIterable.anySatisfyWith(predicate, parameter);
 
380
        }
 
381
    }
 
382
 
 
383
    public <P> boolean allSatisfyWith(Predicate2<? super V, ? super P> predicate, P parameter)
 
384
    {
 
385
        synchronized (this.lock)
 
386
        {
 
387
            return this.mapIterable.allSatisfyWith(predicate, parameter);
 
388
        }
 
389
    }
 
390
 
 
391
    public <P> boolean noneSatisfyWith(Predicate2<? super V, ? super P> predicate, P parameter)
 
392
    {
 
393
        synchronized (this.lock)
 
394
        {
 
395
            return this.mapIterable.noneSatisfyWith(predicate, parameter);
 
396
        }
 
397
    }
 
398
 
 
399
    public <IV> IV injectInto(IV injectedValue, Function2<? super IV, ? super V, ? extends IV> function)
 
400
    {
 
401
        synchronized (this.lock)
 
402
        {
 
403
            return this.mapIterable.injectInto(injectedValue, function);
 
404
        }
 
405
    }
 
406
 
 
407
    public int injectInto(int injectedValue, IntObjectToIntFunction<? super V> function)
 
408
    {
 
409
        synchronized (this.lock)
 
410
        {
 
411
            return this.mapIterable.injectInto(injectedValue, function);
 
412
        }
 
413
    }
 
414
 
 
415
    public long injectInto(long injectedValue, LongObjectToLongFunction<? super V> function)
 
416
    {
 
417
        synchronized (this.lock)
 
418
        {
 
419
            return this.mapIterable.injectInto(injectedValue, function);
 
420
        }
 
421
    }
 
422
 
 
423
    public double injectInto(double injectedValue, DoubleObjectToDoubleFunction<? super V> function)
 
424
    {
 
425
        synchronized (this.lock)
 
426
        {
 
427
            return this.mapIterable.injectInto(injectedValue, function);
 
428
        }
 
429
    }
 
430
 
 
431
    public float injectInto(float injectedValue, FloatObjectToFloatFunction<? super V> function)
 
432
    {
 
433
        synchronized (this.lock)
 
434
        {
 
435
            return this.mapIterable.injectInto(injectedValue, function);
 
436
        }
 
437
    }
 
438
 
 
439
    public long sumOfInt(IntFunction<? super V> function)
 
440
    {
 
441
        synchronized (this.lock)
 
442
        {
 
443
            return this.mapIterable.sumOfInt(function);
 
444
        }
 
445
    }
 
446
 
 
447
    public double sumOfFloat(FloatFunction<? super V> function)
 
448
    {
 
449
        synchronized (this.lock)
 
450
        {
 
451
            return this.mapIterable.sumOfFloat(function);
 
452
        }
 
453
    }
 
454
 
 
455
    public long sumOfLong(LongFunction<? super V> function)
 
456
    {
 
457
        synchronized (this.lock)
 
458
        {
 
459
            return this.mapIterable.sumOfLong(function);
 
460
        }
 
461
    }
 
462
 
 
463
    public double sumOfDouble(DoubleFunction<? super V> function)
 
464
    {
 
465
        synchronized (this.lock)
 
466
        {
 
467
            return this.mapIterable.sumOfDouble(function);
 
468
        }
 
469
    }
 
470
 
 
471
    public MutableList<V> toList()
 
472
    {
 
473
        synchronized (this.lock)
 
474
        {
 
475
            return this.mapIterable.toList();
 
476
        }
 
477
    }
 
478
 
 
479
    public MutableList<V> toSortedList()
 
480
    {
 
481
        synchronized (this.lock)
 
482
        {
 
483
            return this.mapIterable.toSortedList();
 
484
        }
 
485
    }
 
486
 
 
487
    public MutableList<V> toSortedList(Comparator<? super V> comparator)
 
488
    {
 
489
        synchronized (this.lock)
 
490
        {
 
491
            return this.mapIterable.toSortedList(comparator);
 
492
        }
 
493
    }
 
494
 
 
495
    public MutableSortedSet<V> toSortedSet()
 
496
    {
 
497
        synchronized (this.lock)
 
498
        {
 
499
            return this.mapIterable.toSortedSet();
 
500
        }
 
501
    }
 
502
 
 
503
    public MutableSortedSet<V> toSortedSet(Comparator<? super V> comparator)
 
504
    {
 
505
        synchronized (this.lock)
 
506
        {
 
507
            return this.mapIterable.toSortedSet(comparator);
 
508
        }
 
509
    }
 
510
 
 
511
    public MutableSet<V> toSet()
 
512
    {
 
513
        synchronized (this.lock)
 
514
        {
 
515
            return this.mapIterable.toSet();
 
516
        }
 
517
    }
 
518
 
 
519
    public MutableBag<V> toBag()
 
520
    {
 
521
        synchronized (this.lock)
 
522
        {
 
523
            return this.mapIterable.toBag();
 
524
        }
 
525
    }
 
526
 
 
527
    public <NK, NV> MutableMap<NK, NV> toMap(
 
528
            Function<? super V, ? extends NK> keyFunction,
 
529
            Function<? super V, ? extends NV> valueFunction)
 
530
    {
 
531
        synchronized (this.lock)
 
532
        {
 
533
            return this.mapIterable.toMap(keyFunction, valueFunction);
 
534
        }
 
535
    }
 
536
 
 
537
    public <NK, NV> MutableSortedMap<NK, NV> toSortedMap(
 
538
            Function<? super V, ? extends NK> keyFunction,
 
539
            Function<? super V, ? extends NV> valueFunction)
 
540
    {
 
541
        synchronized (this.lock)
 
542
        {
 
543
            return this.mapIterable.toSortedMap(keyFunction, valueFunction);
 
544
        }
 
545
    }
 
546
 
 
547
    public <NK, NV> MutableSortedMap<NK, NV> toSortedMap(
 
548
            Comparator<? super NK> comparator,
 
549
            Function<? super V, ? extends NK> keyFunction,
 
550
            Function<? super V, ? extends NV> valueFunction)
 
551
    {
 
552
        synchronized (this.lock)
 
553
        {
 
554
            return this.mapIterable.toSortedMap(comparator, keyFunction, valueFunction);
 
555
        }
 
556
    }
 
557
 
 
558
    public LazyIterable<V> asLazy()
 
559
    {
 
560
        synchronized (this.lock)
 
561
        {
 
562
            return this.mapIterable.asLazy();
 
563
        }
 
564
    }
 
565
 
 
566
    public Object[] toArray()
 
567
    {
 
568
        synchronized (this.lock)
 
569
        {
 
570
            return this.mapIterable.toArray();
 
571
        }
 
572
    }
 
573
 
 
574
    public <T> T[] toArray(T[] a)
 
575
    {
 
576
        synchronized (this.lock)
 
577
        {
 
578
            return this.mapIterable.toArray(a);
 
579
        }
 
580
    }
 
581
 
 
582
    public V min(Comparator<? super V> comparator)
 
583
    {
 
584
        synchronized (this.lock)
 
585
        {
 
586
            return this.mapIterable.min(comparator);
 
587
        }
 
588
    }
 
589
 
 
590
    public V max(Comparator<? super V> comparator)
 
591
    {
 
592
        synchronized (this.lock)
 
593
        {
 
594
            return this.mapIterable.max(comparator);
 
595
        }
 
596
    }
 
597
 
 
598
    public V min()
 
599
    {
 
600
        synchronized (this.lock)
 
601
        {
 
602
            return this.mapIterable.min();
 
603
        }
 
604
    }
 
605
 
 
606
    public V max()
 
607
    {
 
608
        synchronized (this.lock)
 
609
        {
 
610
            return this.mapIterable.max();
 
611
        }
 
612
    }
 
613
 
 
614
    public String makeString()
 
615
    {
 
616
        synchronized (this.lock)
 
617
        {
 
618
            return this.mapIterable.makeString();
 
619
        }
 
620
    }
 
621
 
 
622
    public String makeString(String separator)
 
623
    {
 
624
        synchronized (this.lock)
 
625
        {
 
626
            return this.mapIterable.makeString(separator);
 
627
        }
 
628
    }
 
629
 
 
630
    public String makeString(String start, String separator, String end)
 
631
    {
 
632
        synchronized (this.lock)
 
633
        {
 
634
            return this.mapIterable.makeString(start, separator, end);
 
635
        }
 
636
    }
 
637
 
 
638
    public void appendString(Appendable appendable)
 
639
    {
 
640
        synchronized (this.lock)
 
641
        {
 
642
            this.mapIterable.appendString(appendable);
 
643
        }
 
644
    }
 
645
 
 
646
    public void appendString(Appendable appendable, String separator)
 
647
    {
 
648
        synchronized (this.lock)
 
649
        {
 
650
            this.mapIterable.appendString(appendable, separator);
 
651
        }
 
652
    }
 
653
 
 
654
    public void appendString(Appendable appendable, String start, String separator, String end)
 
655
    {
 
656
        synchronized (this.lock)
 
657
        {
 
658
            this.mapIterable.appendString(appendable, start, separator, end);
 
659
        }
 
660
    }
 
661
 
 
662
    public <S, R extends Collection<Pair<V, S>>> R zip(Iterable<S> that, R target)
 
663
    {
 
664
        synchronized (this.lock)
 
665
        {
 
666
            return this.mapIterable.zip(that, target);
 
667
        }
 
668
    }
 
669
 
 
670
    public <R extends Collection<Pair<V, Integer>>> R zipWithIndex(R target)
 
671
    {
 
672
        synchronized (this.lock)
 
673
        {
 
674
            return this.mapIterable.zipWithIndex(target);
 
675
        }
 
676
    }
 
677
 
 
678
    public RichIterable<RichIterable<V>> chunk(int size)
 
679
    {
 
680
        synchronized (this.lock)
 
681
        {
 
682
            return this.mapIterable.chunk(size);
 
683
        }
 
684
    }
 
685
 
 
686
    public <KK, R extends MutableMultimap<KK, V>> R groupBy(Function<? super V, ? extends KK> function, R target)
 
687
    {
 
688
        synchronized (this.lock)
 
689
        {
 
690
            return this.mapIterable.groupBy(function, target);
 
691
        }
 
692
    }
 
693
 
 
694
    public <KK, R extends MutableMultimap<KK, V>> R groupByEach(Function<? super V, ? extends Iterable<KK>> function, R target)
 
695
    {
 
696
        synchronized (this.lock)
 
697
        {
 
698
            return this.mapIterable.groupByEach(function, target);
 
699
        }
 
700
    }
 
701
 
 
702
    public <A extends Comparable<? super A>> V minBy(Function<? super V, ? extends A> function)
 
703
    {
 
704
        synchronized (this.lock)
 
705
        {
 
706
            return this.mapIterable.minBy(function);
 
707
        }
 
708
    }
 
709
 
 
710
    public <A extends Comparable<? super A>> V maxBy(Function<? super V, ? extends A> function)
 
711
    {
 
712
        synchronized (this.lock)
 
713
        {
 
714
            return this.mapIterable.maxBy(function);
 
715
        }
 
716
    }
 
717
 
 
718
    public <A extends Comparable<? super A>> MutableSortedSet<V> toSortedSetBy(Function<? super V, ? extends A> function)
 
719
    {
 
720
        synchronized (this.lock)
 
721
        {
 
722
            return this.mapIterable.toSortedSetBy(function);
 
723
        }
 
724
    }
 
725
 
 
726
    public <A extends Comparable<? super A>> MutableList<V> toSortedListBy(Function<? super V, ? extends A> function)
 
727
    {
 
728
        synchronized (this.lock)
 
729
        {
 
730
            return this.mapIterable.toSortedListBy(function);
 
731
        }
 
732
    }
 
733
 
 
734
    public <A, R extends Collection<A>> R flatCollect(Function<? super V, ? extends Iterable<A>> function, R target)
 
735
    {
 
736
        synchronized (this.lock)
 
737
        {
 
738
            return this.mapIterable.flatCollect(function, target);
 
739
        }
 
740
    }
 
741
 
 
742
    public <P, A> RichIterable<A> collectWith(
 
743
            Function2<? super V, ? super P, ? extends A> function,
 
744
            P parameter)
 
745
    {
 
746
        synchronized (this.lock)
 
747
        {
 
748
            return this.mapIterable.collectWith(function, parameter);
 
749
        }
 
750
    }
 
751
 
 
752
    public <A, R extends Collection<A>> R collectIf(
 
753
            Predicate<? super V> predicate,
 
754
            Function<? super V, ? extends A> function,
 
755
            R target)
 
756
    {
 
757
        synchronized (this.lock)
 
758
        {
 
759
            return this.mapIterable.collectIf(predicate, function, target);
 
760
        }
 
761
    }
 
762
 
 
763
    public <P, A, R extends Collection<A>> R collectWith(
 
764
            Function2<? super V, ? super P, ? extends A> function,
 
765
            P parameter,
 
766
            R targetCollection)
 
767
    {
 
768
        synchronized (this.lock)
 
769
        {
 
770
            return this.mapIterable.collectWith(function, parameter, targetCollection);
 
771
        }
 
772
    }
 
773
 
 
774
    public <A, R extends Collection<A>> R collect(
 
775
            Function<? super V, ? extends A> function,
 
776
            R target)
 
777
    {
 
778
        synchronized (this.lock)
 
779
        {
 
780
            return this.mapIterable.collect(function, target);
 
781
        }
 
782
    }
 
783
 
 
784
    public <R extends MutableBooleanCollection> R collectBoolean(BooleanFunction<? super V> booleanFunction, R target)
 
785
    {
 
786
        synchronized (this.lock)
 
787
        {
 
788
            return this.mapIterable.collectBoolean(booleanFunction, target);
 
789
        }
 
790
    }
 
791
 
 
792
    public <R extends MutableByteCollection> R collectByte(ByteFunction<? super V> byteFunction, R target)
 
793
    {
 
794
        synchronized (this.lock)
 
795
        {
 
796
            return this.mapIterable.collectByte(byteFunction, target);
 
797
        }
 
798
    }
 
799
 
 
800
    public <R extends MutableCharCollection> R collectChar(CharFunction<? super V> charFunction, R target)
 
801
    {
 
802
        synchronized (this.lock)
 
803
        {
 
804
            return this.mapIterable.collectChar(charFunction, target);
 
805
        }
 
806
    }
 
807
 
 
808
    public <R extends MutableDoubleCollection> R collectDouble(DoubleFunction<? super V> doubleFunction, R target)
 
809
    {
 
810
        synchronized (this.lock)
 
811
        {
 
812
            return this.mapIterable.collectDouble(doubleFunction, target);
 
813
        }
 
814
    }
 
815
 
 
816
    public <R extends MutableFloatCollection> R collectFloat(FloatFunction<? super V> floatFunction, R target)
 
817
    {
 
818
        synchronized (this.lock)
 
819
        {
 
820
            return this.mapIterable.collectFloat(floatFunction, target);
 
821
        }
 
822
    }
 
823
 
 
824
    public <R extends MutableIntCollection> R collectInt(IntFunction<? super V> intFunction, R target)
 
825
    {
 
826
        synchronized (this.lock)
 
827
        {
 
828
            return this.mapIterable.collectInt(intFunction, target);
 
829
        }
 
830
    }
 
831
 
 
832
    public <R extends MutableLongCollection> R collectLong(LongFunction<? super V> longFunction, R target)
 
833
    {
 
834
        synchronized (this.lock)
 
835
        {
 
836
            return this.mapIterable.collectLong(longFunction, target);
 
837
        }
 
838
    }
 
839
 
 
840
    public <R extends MutableShortCollection> R collectShort(ShortFunction<? super V> shortFunction, R target)
 
841
    {
 
842
        synchronized (this.lock)
 
843
        {
 
844
            return this.mapIterable.collectShort(shortFunction, target);
 
845
        }
 
846
    }
 
847
 
 
848
    public void forEach(Procedure<? super V> procedure)
 
849
    {
 
850
        synchronized (this.lock)
 
851
        {
 
852
            this.mapIterable.forEach(procedure);
 
853
        }
 
854
    }
 
855
 
 
856
    public void forEachWithIndex(ObjectIntProcedure<? super V> objectIntProcedure)
 
857
    {
 
858
        synchronized (this.lock)
 
859
        {
 
860
            this.mapIterable.forEachWithIndex(objectIntProcedure);
 
861
        }
 
862
    }
 
863
 
 
864
    public <P> void forEachWith(Procedure2<? super V, ? super P> procedure2, P parameter)
 
865
    {
 
866
        synchronized (this.lock)
 
867
        {
 
868
            this.mapIterable.forEachWith(procedure2, parameter);
 
869
        }
 
870
    }
 
871
 
 
872
    public Iterator<V> iterator()
 
873
    {
 
874
        return this.mapIterable.iterator();
 
875
    }
 
876
}
 
877