【對(duì)線面試官】今天來聊聊Java泛型





public?interface?JpaRepository<T,?ID>?extends?PagingAndSortingRepository<T,?ID>,?QueryByExampleExecutor<T>?{
?List?findAll() ;
?List?findAll(Sort?sort) ;
?List?findAllById(Iterable?ids) ;
??List?saveAll(Iterable?entities);
?void?flush();
??S?saveAndFlush(S?entity);
?void?deleteInBatch(Iterable?entities) ;
?void?deleteAllInBatch();
?T?getOne(ID?id);
?@Override
??List?findAll(Example?example);
?@Override
??List?findAll(Example?example,?Sort?sort);
}


//?傳入?需要group?by?和?sum?的字段名
public?cacheMap(List?groupByKeys,?List?sumValues) ?{
??this.groupByKeys?=?groupByKeys;
??this.sumValues?=?sumValues;
}
private?void?excute(T?e)?{
??
??//?從pojo?取出需要group?by?的字段?list
??List


文章以純面試的角度去講解,所以有很多的細(xì)節(jié)是未鋪墊的。
比如說反射和泛型基礎(chǔ),這些在【Java3y】都有過詳細(xì)的基本教程甚至電子書,我就不再詳述了?;貜?fù)「888」即可獲取
添加我的微信【sanwaiyihao】進(jìn)一步交流和學(xué)習(xí)

評(píng)論
圖片
表情
