<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      導航

      嘗試理解FunctionalInterface

      在網上找了例子,自己改改,寫寫,注釋注釋。下面把我對functionalinterface里面的function的理解過程貼上來。

      import java.util.Objects;

      @FunctionalInterface
      public interface FunctionC<T,R>{
      /**
      * function of interface FunctionC<T,R>
      */
      R apply(T t);

      /**
      * using lambda to describe method compose
      * andThen = (T t) -> after.apply(apply(t));
      *
      * default: no need to realized
      *
      * <V>: declare an Object V
      *
      * FunctionC<T,V>: declare an Interface FunctionC but using<T,V>,
      * this means Interface FunctionC<T,V>{ V apply(T t);}
      *
      * andThen: method name
      *
      * FunctionC<? super R, ? extends V> after: declare the param type
      * which is an realized object named 'after' that is of Interface FunctionC but using <? super R, ? extends V>,
      * and that means Interface FunctionC<? super R, ? extends V>{ ? extends V apply(? super R r);}
      * which almostly equals Interface FunctionC<R, V>{ V apply(R r);}
      *
      * by the way, the declaration of this interface is FunctionC<T,R>{ R apply(T t);}
      * so we have declared three interface with type-relationship-table
      *<table>
      *<tr><th>InterfaceGenericType</th><th>ReturnType</th><th>ParamType</th><th>IsEntrance</th></tr>
      *<tr><td>FunctionC<T,R></td><td>R</td><td>T</td><td>No</td></tr>
      *<tr><td>FunctionC<T,V></td><td>V</td><td>T</td><td>Yes</td></tr>
      *<tr><td>FunctionC<R,V></td><td>V</td><td>R</td><td>No</td></tr>
           *</table>
           *
      * then if we want to get V by using T as param, we could use this type-relationship-table
      * we send T to function apply(T) then we get R, and we sent R to function apply(R) we get V.
      * so we get the V by using function ? apply(?), and the type-relationship-table.
      * so we put all we need into the declaretion statement, down here.
      */
      default <V> FunctionC<T,V> andThen(FunctionC <? super R, ? extends V> after){
      Objects.requireNonNull(after);
      return (T t) -> after.apply(apply(t));
      }

      /**
      * using lambda to describe method compose
      * compose = (V v) -> apply(before.apply(v))
      *
      * default: no need to realized
      *
      * <V>: declare an Object V
      *
      * FunctionC<V,R>: declare an Interface FunctionC but using<V,R>,
      * this means Interface FunctionC<V,R>{ R apply(V v);}
      *
      * compose: method name
      *
      * FunctionC <? super V, ? extends T> before: declare the param type
      * which is an realized object named 'before' that is of Interface FunctionC but using <? super V, ? extends T>,
      * and that means Interface FunctionC<? super V, ? extends T>{ ? extends T apply(? super V v);}
      * which almostly equals Interface FunctionC<V, T>{ T apply(V v);}
      *
      * by the way, the declaration of this interface is FunctionC<T,R>{ R apply(T t);}
      * so we have declared three interface with type-relationship-table
      *<table>
      *<tr><th>InterfaceGenericType</th><th>ReturnType</th><th>ParamType</th><th>IsEntrance</th></tr>
      *<tr><td>FunctionC<T,R></td><td>R</td><td>T</td><td>No</td></tr>
      *<tr><td>FunctionC<V,R></td><td>R</td><td>V</td><td>Yes</td></tr>
      *<tr><td>FunctionC<V,T></td><td>T</td><td>V</td><td>No</td></tr>
      *</table>
      *
      * then if we want to get R by using V as param, we could use this type-relationship-table
      * we send V to function apply(V) then we get T, and we sent T to function apply(T) we get R.
      * so we get the R by using function ? apply(?), and the type-relationship-table.
      * so we put all we need into the declaretion statement, down here.
      */
      default <V> FunctionC<V,R> compose(FunctionC <? super V, ? extends T> before){
      Objects.requireNonNull(before);
      return (V v) -> apply(before.apply(v));
      }
      }

      public class AndThenTest{
      public static void main(String args[]){
      FunctionC<Integer, Integer> func1 = num -> num+1;
      FunctionC<Integer, Integer> func2 = num -> num*10;
      FunctionC<Integer, Integer> func3 = num -> num-5;
      final Integer i = 10;
      System.out.println("========================function.andThen=========================");
      System.out.println("while num is " + i );
      System.out.println(", num+1 is: " + func1.apply(i));
      System.out.println(", and (num+1).andThen(num*10).andThen(num-5) is: " +
      func1.andThen(func2).andThen(func3).apply(i));
      FunctionC<Integer, Integer> func4 = num -> num;
      System.out.println("use lambda num.andThen(num -> num*10).andThen(num -> num-5) is: " +
      func4.andThen(num -> num*10).andThen(num -> num-5).apply(i));

      System.out.println("========================function.compose=========================");
      System.out.println("while num is " + i );
      System.out.println(", num+1 is: " + func1.apply(i));
      System.out.println(", and (num+1).compose.(num*10).compose(num-5) is: " +
      func1.compose(func2).compose(func3).apply(i));
      }
      }

      posted on 2025-10-21 17:56  扭頭撞到墻  閱讀(3)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 九九热免费精品视频在线| 欧美国产日产一区二区| 日本精品不卡一二三区| 2019国产精品青青草原| 高潮喷水抽搐无码免费| 国产高清在线精品一区| 亚洲高清aⅴ日本欧美视频| 欧美最新精品videossexohd| 色一情一乱一区二区三区码| 亚洲国产精品无码一区二区三区| 亚洲国产美女精品久久久| 毛多水多高潮高清视频 | 日本一区不卡高清更新二区| 人妻少妇邻居少妇好多水在线| 亚洲伊人久久大香线蕉| 国产精品午夜福利在线观看| 无码精品一区二区免费AV| 亚洲男同志网站| 国产亚洲无线码一区二区| 在线 欧美 中文 亚洲 精品| 欧美综合婷婷欧美综合五月| 国产综合一区二区三区麻豆| 亚洲国产欧美在线人成AAAA| 无码h片在线观看网站| 乐业县| 亚洲美免无码中文字幕在线| 在线天堂中文新版www| 亚洲影院丰满少妇中文字幕无码 | 337p粉嫩大胆色噜噜噜| 妺妺窝人体色www婷婷| 男女做爰真人视频直播| 人妻一本久道久久综合鬼色| 男女xx00上下抽搐动态图| 麻豆国产传媒精品视频| 亚洲伊人久久大香线蕉| 蜜臀av久久国产午夜福利软件| 浪潮av色综合久久天堂| 射阳县| 男女性高爱潮免费网站| 国产亚洲精品97在线视频一| 久久国产精品夜色|