Class Procedures2
- java.lang.Object
-
- org.eclipse.collections.impl.block.factory.Procedures2
-
public final class Procedures2 extends java.lang.Object
Contains factory methods for creatingProcedure2
instances.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
Procedures2.AddToCollection<T>
private static class
Procedures2.ProcedureAdapter<T,P>
private static class
Procedures2.RemoveFromCollection<T>
private static class
Procedures2.ThrowingProcedure2Adapter<T,P>
-
Field Summary
Fields Modifier and Type Field Description static Procedure2<?,?>
ADD_TO_COLLECTION
static Procedure2<?,?>
REMOVE_FROM_COLLECTION
-
Constructor Summary
Constructors Modifier Constructor Description private
Procedures2()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Procedure2<T,java.util.Collection<T>>
addToCollection()
static <T,P>
Procedure2<T,P>fromProcedure(Procedure<? super T> procedure)
static <T> Procedure2<T,java.util.Collection<T>>
removeFromCollection()
static <T> Procedure2<java.util.DoubleSummaryStatistics,T>
summarizeDouble(DoubleFunction<? super T> function)
static <T> Procedure2<java.util.DoubleSummaryStatistics,T>
summarizeFloat(FloatFunction<? super T> function)
static <T> Procedure2<java.util.IntSummaryStatistics,T>
summarizeInt(IntFunction<? super T> function)
static <T> Procedure2<java.util.LongSummaryStatistics,T>
summarizeLong(LongFunction<? super T> function)
static <T,P>
Procedure2<T,P>throwing(ThrowingProcedure2<T,P> throwingProcedure2)
Allows a lambda or anonymous inner class that needs to throw a checked exception to be safely wrapped as a Procedure2 that will throw a RuntimeException, wrapping the checked exception that is the cause.static <T1,T2>
Procedure2<T1,T2>throwing(ThrowingProcedure2<T1,T2> throwingProcedure, Function3<T1,T2,? super java.lang.Throwable,? extends java.lang.RuntimeException> rethrow)
Allows a lambda or anonymous inner class that needs to throw a checked exception to be safely wrapped as a Procedure2 that will throw a user specified RuntimeException based on the provided function.
-
-
-
Field Detail
-
ADD_TO_COLLECTION
public static final Procedure2<?,?> ADD_TO_COLLECTION
-
REMOVE_FROM_COLLECTION
public static final Procedure2<?,?> REMOVE_FROM_COLLECTION
-
-
Method Detail
-
throwing
public static <T,P> Procedure2<T,P> throwing(ThrowingProcedure2<T,P> throwingProcedure2)
Allows a lambda or anonymous inner class that needs to throw a checked exception to be safely wrapped as a Procedure2 that will throw a RuntimeException, wrapping the checked exception that is the cause.
-
throwing
public static <T1,T2> Procedure2<T1,T2> throwing(ThrowingProcedure2<T1,T2> throwingProcedure, Function3<T1,T2,? super java.lang.Throwable,? extends java.lang.RuntimeException> rethrow)
Allows a lambda or anonymous inner class that needs to throw a checked exception to be safely wrapped as a Procedure2 that will throw a user specified RuntimeException based on the provided function. The function is passed the current element and the checked exception that was thrown as context arguments.
-
fromProcedure
public static <T,P> Procedure2<T,P> fromProcedure(Procedure<? super T> procedure)
-
addToCollection
public static <T> Procedure2<T,java.util.Collection<T>> addToCollection()
-
removeFromCollection
public static <T> Procedure2<T,java.util.Collection<T>> removeFromCollection()
-
summarizeDouble
public static <T> Procedure2<java.util.DoubleSummaryStatistics,T> summarizeDouble(DoubleFunction<? super T> function)
- Since:
- 9.2.
-
summarizeFloat
public static <T> Procedure2<java.util.DoubleSummaryStatistics,T> summarizeFloat(FloatFunction<? super T> function)
- Since:
- 9.2.
-
summarizeInt
public static <T> Procedure2<java.util.IntSummaryStatistics,T> summarizeInt(IntFunction<? super T> function)
- Since:
- 9.2.
-
summarizeLong
public static <T> Procedure2<java.util.LongSummaryStatistics,T> summarizeLong(LongFunction<? super T> function)
- Since:
- 9.2.
-
-