title: What are functional interfaces used for in Java 8?
body: <p>I came across a new term in Java 8: &quot;functional interface&quot;. I could only find one use of it while working with <em>lambda expressions</em>.</p>
  <p>Java 8 provides some built-in functional interfaces and if we want to define any functional interface then we can make use of the <code>@FunctionalInterface</code> annotation. It will allow us to declare only a single method in the interface.</p>
  <p>For example:</p>
  <pre><code>@FunctionalInterface
  interface MathOperation {
      int operation(int a, int b);
  }
  </code></pre>
  <p>How useful it is in Java 8 other than just working with <em>lambda expressions</em>?</p>
  <p>(The question <a href="https://stackoverflow.com/questions/33010594/why-do-i-need-a-functional-interface-to-work-with-lambdas">here</a> is different from the one I asked. It is asking why we need functional interfaces while working with lambda expressions. My question is: What are the other uses of functional interfaces besides use with lambda expressions?)</p>