当前位置:网站首页>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
边栏推荐
- LabVIEW AI视觉工具包(非NI Vision)下载与安装教程
- [极客大挑战 2019]BabySQL-1|SQL注入
- Client service registration of Nacos registry
- [pyGame practice] the super interesting bubble game is coming - may you be childlike and always happy and simple~
- Application of mobile face stylization Technology
- 108. Introduction to the usage of SAP ui5 image display control Avatar
- [pyGame practice] when the end of the world comes, how long can you live in a cruel survival game that really starts from scratch?
- 【补题日记】[2022牛客暑期多校2]H-Take the Elevator
- [diary of supplementary questions] [2022 Niuke summer multi school 2] i-let fat tension
- Good use explosion! The idea version of postman has been released, and its functions are really powerful
猜你喜欢

Simple selection sort and heap sort

「以云为核,无感极速」第五代验证码重磅来袭

Service Workers让网站动态加载Webp图片

Redis安装

游戏流程与底层实现 逐步完成

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

Good use explosion! The idea version of postman has been released, and its functions are really powerful

Specific process of strong cache and negotiation cache

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

China business CDP white paper | love Analysis Report
随机推荐
Service workers let the website dynamically load webp pictures
Can dynamic partitions be configured when MySQL is offline synchronized to ODPs
【补题日记】[2022牛客暑期多校2]I-let fat tension
Summary of common RSA related problems in CTF: basic RSA encryption and decryption
Go deadlock - when the channel meets mutex
可视化大型时间序列的技巧。
R language uses oneway The test function performs one-way ANOVA
Traversal and copy of files in jar package
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
Localization, low latency, green and low carbon: Alibaba cloud officially launched Fuzhou data center
P5472 [NOI2019] 斗主地(期望、数学)
Upgrading of computing power under the coordination of software and hardware, redefining productivity
STL の 概念及其应用
[diary of supplementary questions] [2022 Niuke summer school 2] h-take the elevator
AlexNet—论文分析及复现
What is WordPress
程序的存储态与运行态
Unity遇坑记之 ab包卸载失败
How to deal with invalid objects monitored by Oracle every day in the production environment?
An example of the mandatory measures of Microsoft edge browser tracking prevention