2
* Copyright 2014 Goldman Sachs.
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
8
* http://www.apache.org/licenses/LICENSE-2.0
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.
17
package com.gs.collections.impl.stack.mutable;
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;
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;
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)}.
85
* @see MutableStack#asSynchronized()
87
public final class SynchronizedStack<T> implements MutableStack<T>, Serializable
89
private static final long serialVersionUID = 1L;
90
private final Object lock;
91
private final MutableStack<T> delegate;
93
public SynchronizedStack(MutableStack<T> newStack)
98
public SynchronizedStack(MutableStack<T> newStack, Object newLock)
100
if (newStack == null)
102
throw new IllegalArgumentException("Cannot create a SynchronizedStack on a null stack");
104
this.delegate = newStack;
105
this.lock = newLock == null ? this : newLock;
109
* This method will take a MutableStack and wrap it directly in a SynchronizedStack.
111
public static <T, S extends MutableStack<T>> SynchronizedStack<T> of(S stack)
113
return new SynchronizedStack<T>(stack);
118
synchronized (this.lock)
120
return this.delegate.pop();
124
public ListIterable<T> pop(int count)
126
synchronized (this.lock)
128
return this.delegate.pop(count);
132
public <R extends Collection<T>> R pop(int count, R targetCollection)
134
synchronized (this.lock)
136
return this.delegate.pop(count, targetCollection);
140
public <R extends MutableStack<T>> R pop(int count, R targetStack)
142
synchronized (this.lock)
144
return this.delegate.pop(count, targetStack);
150
synchronized (this.lock)
152
this.delegate.clear();
156
public void push(T item)
158
synchronized (this.lock)
160
this.delegate.push(item);
166
synchronized (this.lock)
168
return this.delegate.peek();
172
public ListIterable<T> peek(int count)
174
synchronized (this.lock)
176
return this.delegate.peek(count);
180
public T peekAt(int index)
182
synchronized (this.lock)
184
return this.delegate.peekAt(index);
188
public MutableStack<T> select(Predicate<? super T> predicate)
190
synchronized (this.lock)
192
return this.delegate.select(predicate);
196
public <P> MutableStack<T> selectWith(Predicate2<? super T, ? super P> predicate, P parameter)
198
synchronized (this.lock)
200
return this.delegate.selectWith(predicate, parameter);
204
public <R extends Collection<T>> R select(Predicate<? super T> predicate, R target)
206
synchronized (this.lock)
208
return this.delegate.select(predicate, target);
212
public <P, R extends Collection<T>> R selectWith(Predicate2<? super T, ? super P> predicate, P parameter, R targetCollection)
214
synchronized (this.lock)
216
return this.delegate.selectWith(predicate, parameter, targetCollection);
220
public MutableStack<T> reject(Predicate<? super T> predicate)
222
synchronized (this.lock)
224
return this.delegate.reject(predicate);
228
public <P> MutableStack<T> rejectWith(Predicate2<? super T, ? super P> predicate, P parameter)
230
synchronized (this.lock)
232
return this.delegate.rejectWith(predicate, parameter);
236
public <R extends Collection<T>> R reject(Predicate<? super T> predicate, R target)
238
synchronized (this.lock)
240
return this.delegate.reject(predicate, target);
244
public <P, R extends Collection<T>> R rejectWith(Predicate2<? super T, ? super P> predicate, P parameter, R targetCollection)
246
synchronized (this.lock)
248
return this.delegate.rejectWith(predicate, parameter, targetCollection);
252
public PartitionMutableStack<T> partition(Predicate<? super T> predicate)
254
synchronized (this.lock)
256
return this.delegate.partition(predicate);
260
public <P> PartitionMutableStack<T> partitionWith(Predicate2<? super T, ? super P> predicate, P parameter)
262
synchronized (this.lock)
264
return this.delegate.partitionWith(predicate, parameter);
268
public <S> RichIterable<S> selectInstancesOf(Class<S> clazz)
270
synchronized (this.lock)
272
return this.delegate.selectInstancesOf(clazz);
276
public <V> MutableStack<V> collect(Function<? super T, ? extends V> function)
278
synchronized (this.lock)
280
return this.delegate.collect(function);
284
public MutableBooleanStack collectBoolean(BooleanFunction<? super T> booleanFunction)
286
synchronized (this.lock)
288
return this.delegate.collectBoolean(booleanFunction);
292
public <R extends MutableBooleanCollection> R collectBoolean(BooleanFunction<? super T> booleanFunction, R target)
294
synchronized (this.lock)
296
return this.delegate.collectBoolean(booleanFunction, target);
300
public MutableByteStack collectByte(ByteFunction<? super T> byteFunction)
302
synchronized (this.lock)
304
return this.delegate.collectByte(byteFunction);
308
public <R extends MutableByteCollection> R collectByte(ByteFunction<? super T> byteFunction, R target)
310
synchronized (this.lock)
312
return this.delegate.collectByte(byteFunction, target);
316
public MutableCharStack collectChar(CharFunction<? super T> charFunction)
318
synchronized (this.lock)
320
return this.delegate.collectChar(charFunction);
324
public <R extends MutableCharCollection> R collectChar(CharFunction<? super T> charFunction, R target)
326
synchronized (this.lock)
328
return this.delegate.collectChar(charFunction, target);
332
public MutableDoubleStack collectDouble(DoubleFunction<? super T> doubleFunction)
334
synchronized (this.lock)
336
return this.delegate.collectDouble(doubleFunction);
340
public <R extends MutableDoubleCollection> R collectDouble(DoubleFunction<? super T> doubleFunction, R target)
342
synchronized (this.lock)
344
return this.delegate.collectDouble(doubleFunction, target);
348
public MutableFloatStack collectFloat(FloatFunction<? super T> floatFunction)
350
synchronized (this.lock)
352
return this.delegate.collectFloat(floatFunction);
356
public <R extends MutableFloatCollection> R collectFloat(FloatFunction<? super T> floatFunction, R target)
358
synchronized (this.lock)
360
return this.delegate.collectFloat(floatFunction, target);
364
public MutableIntStack collectInt(IntFunction<? super T> intFunction)
366
synchronized (this.lock)
368
return this.delegate.collectInt(intFunction);
372
public <R extends MutableIntCollection> R collectInt(IntFunction<? super T> intFunction, R target)
374
synchronized (this.lock)
376
return this.delegate.collectInt(intFunction, target);
380
public MutableLongStack collectLong(LongFunction<? super T> longFunction)
382
synchronized (this.lock)
384
return this.delegate.collectLong(longFunction);
388
public <R extends MutableLongCollection> R collectLong(LongFunction<? super T> longFunction, R target)
390
synchronized (this.lock)
392
return this.delegate.collectLong(longFunction, target);
396
public MutableShortStack collectShort(ShortFunction<? super T> shortFunction)
398
synchronized (this.lock)
400
return this.delegate.collectShort(shortFunction);
404
public <R extends MutableShortCollection> R collectShort(ShortFunction<? super T> shortFunction, R target)
406
synchronized (this.lock)
408
return this.delegate.collectShort(shortFunction, target);
412
public <V, R extends Collection<V>> R collect(Function<? super T, ? extends V> function, R target)
414
synchronized (this.lock)
416
return this.delegate.collect(function, target);
420
public <P, V> MutableStack<V> collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter)
422
synchronized (this.lock)
424
return this.delegate.collectWith(function, parameter);
428
public <P, V, R extends Collection<V>> R collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter, R targetCollection)
430
synchronized (this.lock)
432
return this.delegate.collectWith(function, parameter, targetCollection);
436
public <V> MutableStack<V> collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function)
438
synchronized (this.lock)
440
return this.delegate.collectIf(predicate, function);
444
public <V, R extends Collection<V>> R collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function, R target)
446
synchronized (this.lock)
448
return this.delegate.collectIf(predicate, function, target);
452
public <V> MutableStack<V> flatCollect(Function<? super T, ? extends Iterable<V>> function)
454
synchronized (this.lock)
456
return this.delegate.flatCollect(function);
460
public <V, R extends Collection<V>> R flatCollect(Function<? super T, ? extends Iterable<V>> function, R target)
462
synchronized (this.lock)
464
return this.delegate.flatCollect(function, target);
468
public <S, R extends Collection<Pair<T, S>>> R zip(Iterable<S> that, R target)
470
synchronized (this.lock)
472
return this.delegate.zip(that, target);
476
public <S> MutableStack<Pair<T, S>> zip(Iterable<S> that)
478
synchronized (this.lock)
480
return this.delegate.zip(that);
484
public <R extends Collection<Pair<T, Integer>>> R zipWithIndex(R target)
486
synchronized (this.lock)
488
return this.delegate.zipWithIndex(target);
492
public MutableStack<Pair<T, Integer>> zipWithIndex()
494
synchronized (this.lock)
496
return this.delegate.zipWithIndex();
502
synchronized (this.lock)
504
return this.delegate.size();
508
public boolean isEmpty()
510
synchronized (this.lock)
512
return this.delegate.isEmpty();
516
public boolean notEmpty()
518
synchronized (this.lock)
520
return this.delegate.notEmpty();
526
synchronized (this.lock)
528
return this.delegate.getFirst();
534
return this.delegate.getLast();
537
public boolean contains(Object object)
539
synchronized (this.lock)
541
return this.delegate.contains(object);
545
public boolean containsAllIterable(Iterable<?> source)
547
synchronized (this.lock)
549
return this.delegate.containsAllIterable(source);
553
public boolean containsAll(Collection<?> source)
555
synchronized (this.lock)
557
return this.delegate.containsAll(source);
561
public boolean containsAllArguments(Object... elements)
563
synchronized (this.lock)
565
return this.delegate.containsAllArguments(elements);
569
public T detect(Predicate<? super T> predicate)
571
synchronized (this.lock)
573
return this.delegate.detect(predicate);
577
public <P> T detectWith(Predicate2<? super T, ? super P> predicate, P parameter)
579
synchronized (this.lock)
581
return this.delegate.detectWith(predicate, parameter);
585
public T detectIfNone(Predicate<? super T> predicate, Function0<? extends T> function)
587
synchronized (this.lock)
589
return this.delegate.detectIfNone(predicate, function);
593
public <P> T detectWithIfNone(Predicate2<? super T, ? super P> predicate, P parameter, Function0<? extends T> function)
595
synchronized (this.lock)
597
return this.delegate.detectWithIfNone(predicate, parameter, function);
601
public int count(Predicate<? super T> predicate)
603
synchronized (this.lock)
605
return this.delegate.count(predicate);
609
public <P> int countWith(Predicate2<? super T, ? super P> predicate, P parameter)
611
synchronized (this.lock)
613
return this.delegate.countWith(predicate, parameter);
617
public boolean anySatisfy(Predicate<? super T> predicate)
619
synchronized (this.lock)
621
return this.delegate.anySatisfy(predicate);
625
public <P> boolean anySatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)
627
synchronized (this.lock)
629
return this.delegate.anySatisfyWith(predicate, parameter);
633
public boolean allSatisfy(Predicate<? super T> predicate)
635
synchronized (this.lock)
637
return this.delegate.allSatisfy(predicate);
641
public <P> boolean allSatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)
643
synchronized (this.lock)
645
return this.delegate.allSatisfyWith(predicate, parameter);
649
public boolean noneSatisfy(Predicate<? super T> predicate)
651
synchronized (this.lock)
653
return this.delegate.noneSatisfy(predicate);
657
public <P> boolean noneSatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)
659
synchronized (this.lock)
661
return this.delegate.noneSatisfyWith(predicate, parameter);
665
public <IV> IV injectInto(IV injectedValue, Function2<? super IV, ? super T, ? extends IV> function)
667
synchronized (this.lock)
669
return this.delegate.injectInto(injectedValue, function);
673
public int injectInto(int injectedValue, IntObjectToIntFunction<? super T> intObjectToIntFunction)
675
synchronized (this.lock)
677
return this.delegate.injectInto(injectedValue, intObjectToIntFunction);
681
public long injectInto(long injectedValue, LongObjectToLongFunction<? super T> longObjectToLongFunction)
683
synchronized (this.lock)
685
return this.delegate.injectInto(injectedValue, longObjectToLongFunction);
689
public float injectInto(float injectedValue, FloatObjectToFloatFunction<? super T> floatObjectToFloatFunction)
691
synchronized (this.lock)
693
return this.delegate.injectInto(injectedValue, floatObjectToFloatFunction);
697
public double injectInto(double injectedValue, DoubleObjectToDoubleFunction<? super T> doubleObjectToDoubleFunction)
699
synchronized (this.lock)
701
return this.delegate.injectInto(injectedValue, doubleObjectToDoubleFunction);
705
public MutableList<T> toList()
707
synchronized (this.lock)
709
return this.delegate.toList();
713
public MutableList<T> toSortedList()
715
synchronized (this.lock)
717
return this.delegate.toSortedList();
721
public MutableList<T> toSortedList(Comparator<? super T> comparator)
723
synchronized (this.lock)
725
return this.delegate.toSortedList(comparator);
729
public <V extends Comparable<? super V>> MutableList<T> toSortedListBy(Function<? super T, ? extends V> function)
731
synchronized (this.lock)
733
return this.delegate.toSortedListBy(function);
737
public MutableSet<T> toSet()
739
synchronized (this.lock)
741
return this.delegate.toSet();
745
public MutableSortedSet<T> toSortedSet()
747
synchronized (this.lock)
749
return this.delegate.toSortedSet();
753
public MutableSortedSet<T> toSortedSet(Comparator<? super T> comparator)
755
synchronized (this.lock)
757
return this.delegate.toSortedSet(comparator);
761
public MutableStack<T> toStack()
763
synchronized (this.lock)
765
return this.delegate.toStack();
769
public ImmutableStack<T> toImmutable()
771
synchronized (this.lock)
773
return this.delegate.toImmutable();
777
public <V extends Comparable<? super V>> MutableSortedSet<T> toSortedSetBy(Function<? super T, ? extends V> function)
779
synchronized (this.lock)
781
return this.delegate.toSortedSetBy(function);
785
public MutableBag<T> toBag()
787
synchronized (this.lock)
789
return this.delegate.toBag();
793
public <NK, NV> MutableMap<NK, NV> toMap(Function<? super T, ? extends NK> keyFunction, Function<? super T, ? extends NV> valueFunction)
795
synchronized (this.lock)
797
return this.delegate.toMap(keyFunction, valueFunction);
801
public <NK, NV> MutableSortedMap<NK, NV> toSortedMap(Function<? super T, ? extends NK> keyFunction, Function<? super T, ? extends NV> valueFunction)
803
synchronized (this.lock)
805
return this.delegate.toSortedMap(keyFunction, valueFunction);
809
public <NK, NV> MutableSortedMap<NK, NV> toSortedMap(Comparator<? super NK> comparator, Function<? super T, ? extends NK> keyFunction, Function<? super T, ? extends NV> valueFunction)
811
synchronized (this.lock)
813
return this.delegate.toSortedMap(comparator, keyFunction, valueFunction);
817
public LazyIterable<T> asLazy()
819
synchronized (this.lock)
821
return this.delegate.asLazy();
825
public Object[] toArray()
827
synchronized (this.lock)
829
return this.delegate.toArray();
833
public <T> T[] toArray(T[] a)
835
synchronized (this.lock)
837
return this.delegate.toArray(a);
841
public T min(Comparator<? super T> comparator)
843
synchronized (this.lock)
845
return this.delegate.min(comparator);
849
public T max(Comparator<? super T> comparator)
851
synchronized (this.lock)
853
return this.delegate.max(comparator);
859
synchronized (this.lock)
861
return this.delegate.min();
867
synchronized (this.lock)
869
return this.delegate.max();
873
public <V extends Comparable<? super V>> T minBy(Function<? super T, ? extends V> function)
875
synchronized (this.lock)
877
return this.delegate.minBy(function);
881
public <V extends Comparable<? super V>> T maxBy(Function<? super T, ? extends V> function)
883
synchronized (this.lock)
885
return this.delegate.maxBy(function);
889
public long sumOfInt(IntFunction<? super T> intFunction)
891
synchronized (this.lock)
893
return this.delegate.sumOfInt(intFunction);
897
public double sumOfFloat(FloatFunction<? super T> floatFunction)
899
synchronized (this.lock)
901
return this.delegate.sumOfFloat(floatFunction);
905
public long sumOfLong(LongFunction<? super T> longFunction)
907
synchronized (this.lock)
909
return this.delegate.sumOfLong(longFunction);
913
public double sumOfDouble(DoubleFunction<? super T> doubleFunction)
915
synchronized (this.lock)
917
return this.delegate.sumOfDouble(doubleFunction);
921
public String makeString()
923
synchronized (this.lock)
925
return this.delegate.makeString();
929
public String makeString(String separator)
931
synchronized (this.lock)
933
return this.delegate.makeString(separator);
937
public String makeString(String start, String separator, String end)
939
synchronized (this.lock)
941
return this.delegate.makeString(start, separator, end);
945
public void appendString(Appendable appendable)
947
synchronized (this.lock)
949
this.delegate.appendString(appendable);
953
public void appendString(Appendable appendable, String separator)
955
synchronized (this.lock)
957
this.delegate.appendString(appendable, separator);
961
public void appendString(Appendable appendable, String start, String separator, String end)
963
synchronized (this.lock)
965
this.delegate.appendString(appendable, start, separator, end);
969
public <V> MutableListMultimap<V, T> groupBy(Function<? super T, ? extends V> function)
971
synchronized (this.lock)
973
return this.delegate.groupBy(function);
977
public <V, R extends MutableMultimap<V, T>> R groupBy(Function<? super T, ? extends V> function, R target)
979
synchronized (this.lock)
981
return this.delegate.groupBy(function, target);
985
public <V> MutableListMultimap<V, T> groupByEach(Function<? super T, ? extends Iterable<V>> function)
987
synchronized (this.lock)
989
return this.delegate.groupByEach(function);
993
public <V, R extends MutableMultimap<V, T>> R groupByEach(Function<? super T, ? extends Iterable<V>> function, R target)
995
synchronized (this.lock)
997
return this.delegate.groupByEach(function, target);
1001
public <V> MutableMap<V, T> groupByUniqueKey(Function<? super T, ? extends V> function)
1003
synchronized (this.lock)
1005
return this.delegate.groupByUniqueKey(function);
1009
public RichIterable<RichIterable<T>> chunk(int size)
1011
synchronized (this.lock)
1013
return this.delegate.chunk(size);
1017
public void forEach(Procedure<? super T> procedure)
1019
synchronized (this.lock)
1021
this.delegate.forEach(procedure);
1026
public String toString()
1028
synchronized (this.lock)
1030
return this.delegate.toString();
1034
public void forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)
1036
synchronized (this.lock)
1038
this.delegate.forEachWithIndex(objectIntProcedure);
1042
public <P> void forEachWith(Procedure2<? super T, ? super P> procedure, P parameter)
1044
synchronized (this.lock)
1046
this.delegate.forEachWith(procedure, parameter);
1050
public MutableStack<T> asUnmodifiable()
1052
synchronized (this.lock)
1054
return this.delegate.asUnmodifiable();
1059
public boolean equals(Object obj)
1061
synchronized (this.lock)
1063
return this.delegate.equals(obj);
1068
public int hashCode()
1070
synchronized (this.lock)
1072
return this.delegate.hashCode();
1076
public MutableStack<T> asSynchronized()
1078
synchronized (this.lock)
1084
public Iterator<T> iterator()
1086
return new UnmodifiableIteratorAdapter<T>(this.delegate.iterator());
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)
1094
MutableMap<K, V> map = UnifiedMap.newMap();
1095
this.forEach(new MutatingAggregationProcedure<T, K, V>(map, groupBy, zeroValueFactory, mutatingAggregator));
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)
1104
MutableMap<K, V> map = UnifiedMap.newMap();
1105
this.forEach(new NonMutatingAggregationProcedure<T, K, V>(map, groupBy, zeroValueFactory, nonMutatingAggregator));