当前位置:网站首页>记一次List对象遍历及float类型判断大小
记一次List对象遍历及float类型判断大小
2022-06-27 19:37:00 【可是我还饿啊】
1.对于float类型的数值比较,为了避免精度损失用到了
BigDecimal类
自己封装的工具类
package OPCutils;
import java.math.BigDecimal;
public class We {
public int floatCompare(float a, float b) {
BigDecimal bd1 = BigDecimal.valueOf(a);
BigDecimal bd2 = BigDecimal.valueOf(b);
return bd1.compareTo(bd2);
}
}
具体实现
public void zongceshi(){
OpcSOS opcSOS=new OpcSOS();
List<String> list = opcSOS.luxun();
We we = new We();
List<PlcdataDO> plclist=new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
PlcdataDO plcdataDOS = plcdataDao.selectSub(list.get(i));
plclist.add(plcdataDOS);
}
List<PlcdataDO> plclist1=new ArrayList<>();
for (PlcdataDO plcdataDO:plclist){
int i = we.floatCompa边栏推荐
- Selenium上传文件有多少种方式?不信你有我全!
- Go从入门到实战——多态(笔记)
- 有时间看看ognl表达式
- Process control task
- 哈希表-数组之和
- Système de gestion - itclub (II)
- [LeetCode]动态规划解拆分整数I[Silver Fox]
- How to delete "know this picture" on win11 desktop
- [LeetCode]161. Edit distance of 1
- Go from introduction to practice -- definition and implementation of behavior (notes)
猜你喜欢

Common problems encountered by burp Suite

Go from entry to practice -- CSP concurrency mechanism (note)

Go from introduction to practice -- coordination mechanism (note)

STM32F107+LAN8720A使用STM32cubeMX配置网络连接+tcp主从机+UDP app

Burp suite遇到的常见问题

Bit. Store: long bear market, stable stacking products may become the main theme

Go从入门到实战——Panic和recover(笔记)

Go from introduction to practice - Interface (notes)

Null pointer exception

【Redis】零基础十分钟学会Redis
随机推荐
\w和[A-Za-z0-9_],\d和[0-9]等价吗?
The create database of gbase 8A takes a long time to query and is suspected to be stuck
[LeetCode]513. 找树左下角的值
Go从入门到实战——错误机制(笔记)
Read write separation master-slave replication of MySQL
鲜为人知的mysql导入数据
Dynamic refresh mapper
xpath
Test automatique de Test logiciel - test d'interface de l'introduction à la maîtrise, apprendre un peu chaque jour
Slow bear market, bit Store provides stable stacking products to help you cross the bull and bear
[LeetCode]100. 相同的树
Management system itclub (Part 2)
如何做好功能测试?你确定不想知道吗?
The difference between scrum and Kanban
Interval DP of Changyou dynamic programming
A method of go accessing gbase 8A database
跟我一起AQS SOS AQS
Have time to look at ognl expressions
Go from introduction to practice -- coordination mechanism (note)
MYSQL和MongoDB的分析