1 /*
2 Copyright 2011 Atlassian
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 package io.atlassian.fugue;
17
18 import java.util.function.Consumer;
19
20 /**
21 * A thing that performs a side-effect.
22 *
23 * @param <A> the type that this Effect takes as input
24 *
25 * @since 1.0
26 * @deprecated in favour of {@link Consumer}
27 */
28 @Deprecated @FunctionalInterface public interface Effect<A> extends Consumer<A> {
29 /**
30 * Perform the side-effect.
31 *
32 * @param a the input to use for performing the effect.
33 */
34 void apply(A a);
35
36 /**
37 * Adapt to the Java 8 interface.
38 *
39 * @param a the input to use for performing the effect.
40 * @since 3.0
41 */
42 default void accept(final A a) {
43 apply(a);
44 }
45
46 /**
47 * A thing upon which side-effects may be applied.
48 *
49 * @param <A> the type of thing to supply to the effect.
50 *
51 * @deprecated in favour of {@link Iterable}
52 */
53 @Deprecated @FunctionalInterface interface Applicant<A> {
54 /**
55 * Perform the given side-effect for each contained element.
56 *
57 * @param effect the input to use for performing the effect.
58 *
59 * @deprecated extend or implement {@link Iterable#forEach(Consumer)}
60 * instead
61 */
62 @Deprecated void foreach(Effect<? super A> effect);
63 }
64 }