Java
杂项
请求参数与返回值
ReqReturnDataList < T >
ReqReturnEntity
ReqReturnOptFlag
String
StringUtils . isEmpty ( "字符串" ) ;
StringUtils . isNotEmpty ( "字符串" ) ;
StringUtils . isBlank ( "字符串" ) ;
StringUtils . isNotBlank ( "字符串" ) ;
"abcd" . substring ( 0 , 3 ) ;
"abcd" . substring ( 2 ) ;
"2" . equals ( abc) ;
日期
Date date = new Date ( ) ;
SimpleDateFormat formatter = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss" ) ;
String getDateForMatter = formatter. format ( date) ;
流操作
Map < Long , List < Entity > > entityGroupById= entityList. stream ( ) . collect ( Collectors . groupingBy ( Entity :: getId ) ) ;
Map < String , List < Entity > > entityGroupByIdCode= entityGroupById. get ( id) . stream ( ) . collect ( Collectors . groupingBy ( Entity :: getCode ) ) ;
for ( String key: entityGroupByIdCode. keySet ( ) ) { }
Map < String , String > maps = nameList. stream ( ) . collect ( Collectors . toMap ( Entity :: getKey , Entity :: getName ) ) ;
entitylist. stream ( ) . anyMatch ( x-> x. getCode ( ) . equals ( entity. getCode ( ) ) )
List < String > entitylist= list. stream ( ) . map ( Entity :: getCode ) . distinct ( ) . collect ( Collectors . toList ( ) ) ;
List < Long > idList= list. stream ( ) . map ( i-> i. getId ( ) ) . collect ( Collectors . toList ( ) ) ;
list. stream ( ) . forEach ( System . out:: println ) ;
list. stream ( ) . forEach ( item -> { System . out. println ( "item=" + item) ; } ) ;
for ( Entity item : list) { }
IntelliJ IDEA
快捷键
Ctrl + G //调到制定行数
Ctrl + Alt + o //删除没有用到的引用包
Ctrl + Alt + L //一键排版
Ctrl + Shift +A//例如:可以输入set B。。。 (设置背景)