Class Procedures
- java.lang.Object
-
- org.eclipse.collections.impl.block.factory.Procedures
-
public final class Procedures extends java.lang.Object
Factory class for commonly used procedures.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
Procedures.AppendProcedure<T>
private static class
Procedures.BindProcedure<T,P>
private static class
Procedures.NoopProcedure
private static class
Procedures.ObjectIntProcedureAdapter<T>
private static class
Procedures.PrintlnProcedure<T>
static class
Procedures.SynchronizedProcedure<T>
private static class
Procedures.ThrowingProcedureAdapter<T>
-
Constructor Summary
Constructors Modifier Constructor Description private
Procedures()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <T> Procedure<T>
append(java.lang.Appendable appendable)
static <T,P>
Procedure<T>bind(Procedure2<? super T,? super P> procedure, P parameter)
static <T> CaseProcedure<T>
caseDefault(Procedure<? super T> defaultProcedure)
static <T> CaseProcedure<T>
caseDefault(Procedure<? super T> defaultProcedure, Predicate<? super T> predicate, Procedure<? super T> procedure)
static <T> Procedure<T>
cast(Procedure<T> procedure)
Allows a Java 8 lambda and method to be used in a forEach method without requiring a cast.static <T> Procedure<T>
fromObjectIntProcedure(ObjectIntProcedure<? super T> objectIntProcedure)
static <T> Procedure<T>
fromProcedureWithInt(ObjectIntProcedure<? super T> objectIntProcedure)
Deprecated.since 1.2 - Inlineablestatic <T> Procedure<T>
ifElse(Predicate<? super T> predicate, Procedure<? super T> trueProcedure, Procedure<? super T> falseProcedure)
static <T> Procedure<T>
ifTrue(Predicate<? super T> predicate, Procedure<? super T> block)
static <T> Procedure<T>
noop()
static <T> Procedure<T>
println(java.io.PrintStream stream)
static <T> Procedure<T>
synchronizedEach(Procedure<T> procedure)
static <T> Procedure<T>
throwing(ThrowingProcedure<T> throwingProcedure)
Allows a lambda or anonymous inner class that needs to throw a checked exception to be safely wrapped as a Procedure that will throw a RuntimeException, wrapping the checked exception that is the cause.static <T> Procedure<T>
throwing(ThrowingProcedure<T> throwingProcedure, Function2<T,? 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 Procedure that will throw a user specified RuntimeException based on the provided function.
-
-
-
Method Detail
-
cast
public static <T> Procedure<T> cast(Procedure<T> procedure)
Allows a Java 8 lambda and method to be used in a forEach method without requiring a cast.
-
println
public static <T> Procedure<T> println(java.io.PrintStream stream)
-
append
public static <T> Procedure<T> append(java.lang.Appendable appendable)
-
throwing
public static <T> Procedure<T> throwing(ThrowingProcedure<T> throwingProcedure)
Allows a lambda or anonymous inner class that needs to throw a checked exception to be safely wrapped as a Procedure that will throw a RuntimeException, wrapping the checked exception that is the cause.
-
throwing
public static <T> Procedure<T> throwing(ThrowingProcedure<T> throwingProcedure, Function2<T,? 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 Procedure 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.
-
fromProcedureWithInt
@Deprecated public static <T> Procedure<T> fromProcedureWithInt(ObjectIntProcedure<? super T> objectIntProcedure)
Deprecated.since 1.2 - Inlineable
-
fromObjectIntProcedure
public static <T> Procedure<T> fromObjectIntProcedure(ObjectIntProcedure<? super T> objectIntProcedure)
-
ifTrue
public static <T> Procedure<T> ifTrue(Predicate<? super T> predicate, Procedure<? super T> block)
-
ifElse
public static <T> Procedure<T> ifElse(Predicate<? super T> predicate, Procedure<? super T> trueProcedure, Procedure<? super T> falseProcedure)
-
caseDefault
public static <T> CaseProcedure<T> caseDefault(Procedure<? super T> defaultProcedure)
-
caseDefault
public static <T> CaseProcedure<T> caseDefault(Procedure<? super T> defaultProcedure, Predicate<? super T> predicate, Procedure<? super T> procedure)
-
bind
public static <T,P> Procedure<T> bind(Procedure2<? super T,? super P> procedure, P parameter)
-
noop
public static <T> Procedure<T> noop()
-
-