Home  >  Article  >  Java  >  Java custom functional interface method

Java custom functional interface method

PHPz
PHPzforward
2023-05-21 08:49:06962browse

Explanation

An interface that only contains abstract methods is called a function interface.

1. The object of this interface can be created through Lambda expression. That is, if it is a non-runtime exception, the exception needs to be declared through the abstract method of the target interface).

2. You can use the @functionalinterface comment on an interface to check whether it is a functional interface. Additionally, the javadoc contains a statement indicating that the interface is a functional interface.

Examples

@FunctionalInterface
public interface MyInterface {
    void method1();
}

What collection classes are there in Java

Collections in Java are mainly divided into four categories:

1, List List: ordered, repeatable;

2, Queue queue: ordered, repeatable;

3, Set collection: non-repeatable;

4, Map mapping: unordered, unique keys, non-unique values.

The above is the detailed content of Java custom functional interface method. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete