androidx.core.util.Consumer<T>
- 参数:定义的泛型<T>
- 返回类型:无
- 与java.util.function.Consumer<T>不同的是,它没有API限制
package androidx.core.util;
/**
* Compat version of {@link java.util.function.Consumer}
* @param <T> the type of the input to the operation
*/
public interface Consumer<T> {
/**
* Performs this operation on the given argument.
*
* @param t the input argument
*/
void accept(T t);
}
java.util.Comparable<T>
- 参数:定义的泛型<T>
- 返回类型:int
package java.lang;
import java.util.*;
/**
* This interface imposes a total ordering on the objects of each class that
* implements it. This ordering is referred to as the class's <i>natural
* ordering</i>, and the class's <tt>compareTo</tt> method is referred to as
* its <i>natural comparison method</i>.<p>
*
* @param <T> the type of objects that this object may be compared to
*
* @author Josh Bloch
* @see java.util.Comparator
* @since 1.2
*/
public interface Comparable<T> {
/**
* Compares this object with the specified object for order. Returns a
* negative integer, zero, or a positive integer as this object is less
* than, equal to, or greater than the specified object.
*
* @param o the object to be compared.
* @return a negative integer, zero, or a positive integer as this object
* is less than, equal to, or greater than the specified object.
*
* @throws NullPointerException if the specified object is null
* @throws ClassCastException if the specified object's type prevents it
* from being compared to this object.
*/
public int compareTo(T o);
}
java.util.concurrent.Callable<V>
- 参数:无
- 返回类型:定义的泛型<V>
- 允许你抛异常
package java.util.concurrent;
/**
* A task that returns a result and may throw an exception.
* Implementors define a single method with no arguments called
* {@code call}.
*
* @see Executor
* @since 1.5
* @author Doug Lea
* @param <V> the result type of method {@code call}
*/
@FunctionalInterface
public interface Callable<V> {
/**
* Computes a result, or throws an exception if unable to do so.
*
* @return computed result
* @throws Exception if unable to compute a result
*/
V call() throws Exception;
}
androidx.arch.core.util.Function<I, O>
- 参数:定义的泛型<I>
- 返回类型:定义的泛型<O>
package androidx.arch.core.util;
/**
* Represents a function.
*
* @param <I> the type of the input to the function
* @param <O> the type of the output of the function
*/
public interface Function<I, O> {
/**
* Applies this function to the given input.
*
* @param input the input
* @return the function result.
*/
O apply(I input);
}
java.util.Comparator<T>
- 参数1:定义的泛型<T>
- 参数2:定义的泛型<T>
- 返回类型:int
- 这个接口是做比较的,除了compare方法以外,还有很多诸如:equals和reversed等方法,这里不一一举例。
package java.util;
/**
*
* @param <T> the type of objects that may be compared by this comparator
*
* @author Josh Bloch
* @author Neal Gafter
* @see Comparable
* @see java.io.Serializable
* @since 1.2
*/
@FunctionalInterface
public interface Comparator<T> {
/**
*
* @param o1 the first object to be compared.
* @param o2 the second object to be compared.
* @return a negative integer, zero, or a positive integer as the
* first argument is less than, equal to, or greater than the
* second.
* @throws NullPointerException if an argument is null and this
* comparator does not permit null arguments
* @throws ClassCastException if the arguments' types prevent them from
* being compared by this comparator.
*/
int compare(T o1, T o2);
}
java.lang.Runnable
- 参数:无
- 返回类型:无
package java.lang;
/**
* The <code>Runnable</code> interface should be implemented by any
* class whose instances are intended to be executed by a thread. The
* class must define a method of no arguments called <code>run</code>.
*
* @author Arthur van Hoff
* @see java.lang.Thread
* @see java.util.concurrent.Callable
* @since JDK1.0
*/
@FunctionalInterface
public interface Runnable {
/**
*
* @see java.lang.Thread#run()
*/
public abstract void run();
}