当前位置:网站首页>Code simplification
Code simplification
2022-07-28 11:56:00 【thoughtCodes】
1.1. Using ternary expressions
2. from Java 5 rise , Provides for-each loop , Simplify the circular traversal of arrays and collections . for-each You don't need to allow the tradition for The index in the loop can traverse the array , Or when using iterators, you don't need to while Cyclic invocation hasNext Methods and next Method can traverse the collection .
1.4. utilize return keyword
utilize static keyword , You can turn a field into a static field , You can also turn a function into a static function , When called, there is no need to initialize the class object .
1.6. utilize lambda expression
Static import (import static), When the same static constants and functions are widely used in the program , You can simplify references to static constants and functions .
Recommended reading :
https://www.163.com/dy/article/FCAP8OCA0511FQO9.html
边栏推荐
- 中国业务型CDP白皮书 | 爱分析报告
- Why does acid food hurt teeth + early periodontitis
- ASP. Net core 6 framework unveiling example demonstration [29]: building a file server
- STL concept and its application
- Byte side: how to realize reliable transmission with UDP?
- R language ggplot2 visualization: use the ggboxplot function of ggpubr package to visualize the box diagram and customize the fill parameter to configure the filling color of the box
- R language uses LM function to build regression model, uses the augmented function of bloom package to store the model results in dataframe, and uses ggplot2 to visualize the regression residual diagr
- Shell (I)
- Understand how to prevent tampering and hijacking of device fingerprints
- AlexNet—论文分析及复现
猜你喜欢

A hundred flowers bloom in data analysis engines. Why invest heavily in Clickhouse?

Know the optical fiber interface and supporting optical fiber cable of can optical fiber converter in fire alarm networking

Zotero document manager and its use posture (updated from time to time)

Understand how to prevent tampering and hijacking of device fingerprints

AlexNet—论文分析及复现

Specific process of strong cache and negotiation cache

一文看懂设备指纹如何防篡改、防劫持

程序的存储态与运行态

Introduction to the usage of SAP ui5 image display control avatar trial version

保障邮箱安全,验证码四个优势
随机推荐
Router firmware decryption idea
[diary of supplementary questions] [2022 Niuke summer multi school 2] i-let fat tension
Redis安装
Final modifier attribute
Object to object mapping -automapper
[diary of supplementary questions] [2022 Niuke summer multi school 2] D-Link with game glitch
[geek challenge 2019] babysql-1 | SQL injection
R language uses LM function to build regression model and regression model for transformed data (for example, it is necessary to build regression model for X and y, but they have no linear relationshi
Training mode and practice of digital applied talents in Colleges and Universities under the integration of industry and education
Start from scratch blazor server (2) -- consolidate databases
LabVIEW AI visual Toolkit (non Ni vision) download and installation tutorial
Five Ali technical experts have been offered. How many interview questions can you answer
强缓存、协商缓存具体过程
Develop your own NPM package from 0
OSCache cache monitoring Refresh Tool
In order to ensure the normal operation of fire-fighting equipment in large buildings, the power supply monitoring system of fire-fighting equipment plays a key role
【补题日记】[2022杭电暑期多校2]K-DOS Card
Zotero document manager and its use posture (updated from time to time)
[collection] Advanced Mathematics: Capriccio of stars
Digital twin rail transit: "intelligent" monitoring to clear the pain points of urban operation