Skip to content

Commit

Permalink
Fix compilation errors.
Browse files Browse the repository at this point in the history
Signed-off-by: Nikhil Nanivadekar <nikhil.nanivadekar@gs.com>
  • Loading branch information
nikhilnanivadekar committed Apr 3, 2017
1 parent b52d76f commit a3e14bb
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 12 deletions.
Expand Up @@ -1669,7 +1669,7 @@ public static <T> void assertAnySatisfy(String message, Iterable<T> iterable, Pr
{
try
{
Assert.assertTrue(message, Predicates.anySatisfy(predicate).accept(iterable));
Assert.assertTrue(message, Predicates.<T>anySatisfy(predicate).accept(iterable));
}
catch (AssertionError e)
{
Expand Down
Expand Up @@ -497,15 +497,15 @@ public static <T, V> Function<T, V> ifElse(
public static <T extends Comparable<? super T>, V> CaseFunction<T, V> caseDefault(
Function<? super T, ? extends V> defaultFunction)
{
return new CaseFunction<>(defaultFunction);
return new CaseFunction<T, V>(defaultFunction);
}

public static <T extends Comparable<? super T>, V> CaseFunction<T, V> caseDefault(
Function<? super T, ? extends V> defaultFunction,
Predicate<? super T> predicate,
Function<? super T, ? extends V> function)
{
CaseFunction<T, V> caseFunction = Functions.caseDefault(defaultFunction);
CaseFunction<T, V> caseFunction = Functions.<T, V>caseDefault(defaultFunction);
return caseFunction.addCase(predicate, function);
}

Expand Down
Expand Up @@ -112,7 +112,7 @@ public static <T> Predicates<T> or(Predicate<? super T> predicate1, Predicate<?

public static <T> Predicates<T> or(Predicate<? super T>... predicates)
{
return new OrIterablePredicate<>(Arrays.asList(predicates));
return new OrIterablePredicate<T>(Arrays.asList(predicates));
}

public static <T> Predicates<T> and(Iterable<? extends Predicate<? super T>> predicates)
Expand All @@ -127,7 +127,7 @@ public static <T> Predicates<T> and(Predicate<? super T> predicate1, Predicate<?

public static <T> Predicates<T> and(Predicate<? super T>... predicates)
{
return new AndIterablePredicate<>(Arrays.asList(predicates));
return new AndIterablePredicate<T>(Arrays.asList(predicates));
}

public static <T> Predicates<T> not(Predicate<T> predicate)
Expand All @@ -147,7 +147,7 @@ public static <T> Predicates<T> neither(Predicate<? super T> operation1, Predica

public static <T> Predicates<T> noneOf(Predicate<? super T>... operations)
{
return new NoneOfIterablePredicate<>(Arrays.asList(operations));
return new NoneOfIterablePredicate<T>(Arrays.asList(operations));
}

public static <T> Predicates<T> noneOf(Iterable<? extends Predicate<? super T>> operations)
Expand Down
Expand Up @@ -123,7 +123,7 @@ public static <T> CaseProcedure<T> caseDefault(
Predicate<? super T> predicate,
Procedure<? super T> procedure)
{
return Procedures.caseDefault(defaultProcedure).addCase(predicate, procedure);
return Procedures.<T>caseDefault(defaultProcedure).addCase(predicate, procedure);
}

public static <T> Procedure<T> synchronizedEach(Procedure<T> procedure)
Expand Down
Expand Up @@ -14,6 +14,7 @@

import org.eclipse.collections.api.LazyIterable;
import org.eclipse.collections.api.annotation.Beta;
import org.eclipse.collections.api.bag.MutableBag;
import org.eclipse.collections.api.block.function.Function;
import org.eclipse.collections.api.block.predicate.Predicate;
import org.eclipse.collections.api.block.procedure.Procedure;
Expand Down Expand Up @@ -98,20 +99,23 @@ public <E> E[] toArray(E[] array)
public <V1> UnsortedBagMultimap<V1, V> groupBy(Function<? super V, ? extends V1> function)
{
// TODO: Implement in parallel
return this.delegate.toBag().collect(this.function).groupBy(function);
MutableBag<V> mutableBag = this.delegate.toBag().collect(this.function);
return mutableBag.groupBy(function);
}

@Override
public <V1> UnsortedBagMultimap<V1, V> groupByEach(Function<? super V, ? extends Iterable<V1>> function)
{
// TODO: Implement in parallel
return this.delegate.toBag().collect(this.function).groupByEach(function);
MutableBag<V> mutableBag = this.delegate.toBag().collect(this.function);
return mutableBag.groupByEach(function);
}

@Override
public <V1> MapIterable<V1, V> groupByUniqueKey(Function<? super V, ? extends V1> function)
{
// TODO: Implement in parallel
return this.delegate.toBag().collect(this.function).groupByUniqueKey(function);
MutableBag<V> mutableBag = this.delegate.toBag().collect(this.function);
return mutableBag.groupByUniqueKey(function);
}
}
Expand Up @@ -13,6 +13,7 @@
import java.util.Arrays;

import org.eclipse.collections.api.RichIterable;
import org.eclipse.collections.api.block.procedure.Procedure;
import org.eclipse.collections.api.list.MutableList;
import org.eclipse.collections.api.map.MutableMap;
import org.eclipse.collections.impl.block.factory.Functions;
Expand Down Expand Up @@ -116,8 +117,9 @@ public void anagramsWithMultimapForEachMultiValue()
MutableList<RichIterable<String>> results = Lists.mutable.of();
this.getWords().groupBy(Alphagram::new)
.multiValuesView().forEach(Procedures.ifTrue(iterable -> iterable.size() >= SIZE_THRESHOLD, results::add));
Procedure<String> procedure = Procedures.cast(LOGGER::info);
results.sortThisByInt(iterable -> -iterable.size())
.forEach(Functions.bind(Procedures.cast(LOGGER::info), iterable -> iterable.size() + ": " + iterable));
.forEach(Functions.bind(procedure, iterable -> iterable.size() + ": " + iterable));
Verify.assertIterableSize(SIZE_THRESHOLD, results.getLast());
}

Expand All @@ -129,7 +131,8 @@ public void anagramsUsingMapGetIfAbsentPutInsteadOfGroupBy()
MutableList<MutableList<String>> results =
map.select(iterable -> iterable.size() >= SIZE_THRESHOLD, Lists.mutable.of())
.sortThisByInt(iterable -> -iterable.size());
results.forEach(Functions.bind(Procedures.cast(LOGGER::info), iterable -> iterable.size() + ": " + iterable));
Procedure<String> procedure = Procedures.cast(LOGGER::info);
results.forEach(Functions.bind(procedure, iterable -> iterable.size() + ": " + iterable));
Assert.assertTrue(this.listContainsTestGroupAtElementsOneOrTwo(results));
Verify.assertSize(SIZE_THRESHOLD, results.getLast());
}
Expand Down

0 comments on commit a3e14bb

Please sign in to comment.