Java 实例 - 查找 List 中的最大最小值
Java 教程
· 2019-02-11 18:29:20
以下实例演示了如何使用 Collections 类的 max() 和 min() 方法来获取List中最大最小值:
Main.java 文件
import java.util.*;
public class Main {
public static void main(String[] args) {
List list = Arrays.asList("one Two three Four five six one three Four".split(" "));
System.out.println(list);
System.out.println("最大值: " + Collections.max(list));
System.out.println("最小值: " + Collections.min(list));
}
}
以上代码运行输出结果为:
[one, Two, three, Four, five, six, one, three, Four] 最大值: three 最小值: Four
点击查看所有 Java 教程 文章: https://codercto.com/courses/l/12.html
Python基础教程
[挪] Magnus Lie Hetland / 袁国忠 / 人民邮电出版 / 2018-2-1 / CNY 99.00
本书包括Python程序设计的方方面面:首先从Python的安装开始,随后介绍了Python的基础知识和基本概念,包括列表、元组、字符串、字典以及各种语句;然后循序渐进地介绍了一些相对高级的主题,包括抽象、异常、魔法方法、属性、迭代器;此后探讨了如何将Python与数据库、网络、C语言等工具结合使用,从而发挥出Python的强大功能,同时介绍了Python程序测试、打包、发布等知识;最后,作者结合......一起来看看 《Python基础教程》 这本书的介绍吧!
JS 压缩/解压工具
在线压缩/解压 JS 代码
JSON 在线解析
在线 JSON 格式化工具