聚合操作 步骤 1 : 聚合操作 JDK8之后,引入了对集合的聚合操作,可以非常容易的遍历,筛选,比较集合中的元素。 像这样: String name =heros .stream() .sorted((h1,h2) h1.hp h2.hp? 1:1) .skip(2) .map(h h.getNa ...
分类:
编程语言 时间:
2020-01-09 20:42:29
阅读次数:
72
1. 数字 #整型 print(int(3.41)) #浮点型 print(float(3)) #复数 print(complex(2,3)) #四舍五入为整数 print(round(3.45)) 2. 字符串 #字符串str a=' asDf ' #字符串首字母大写 print(a.title( ...
分类:
编程语言 时间:
2020-01-09 20:38:49
阅读次数:
86
1 li = [{'a':1,'b':4},{'a':2,'b':3},{'a':3,'b':2},{'a':4,'b':1}] 2 print('li',li) 3 #根据a的值倒序排序 4 liNew = sorted(li,key=lambda e:e.__getitem__('a'),rev ...
分类:
编程语言 时间:
2020-01-09 20:30:59
阅读次数:
77
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tree is d ...
分类:
其他好文 时间:
2020-01-09 13:08:36
阅读次数:
69
Sorted 内置函数的排序使用 Sorted 排序列表 1、倒序对列表进行排序 打印结果: [1, 3, 4, 6, 7, 23] 2、正序对列表进行排序 打印结果: [23, 7, 6, 4, 3, 1] Sorted 排序字典 1、对字典中的Key值进行降序排列 Sorted函数中的Key参数 ...
分类:
编程语言 时间:
2020-01-08 19:18:50
阅读次数:
119
1.redis是单进程单线程的。使用了I/O多路复用器,高并发情况下不存在数据安全问题;Memcache是单进程多线程的2.Redis存储K-V结构的数据,Value支持多种数据类型,有String,Hash,Set,SortedSet,List类型;Memcache仅支持简单的k-v结构3.Red ...
分类:
系统相关 时间:
2020-01-08 12:40:21
阅读次数:
94
非coding shortcuts Ctrl+\ to split the active editor into two. in the Quick Open (Ctrl+P) file list. 快速打开最近所用的文件。 side by side 肩并肩,同一排 安装Ctrl 选择多个文件,然后 ...
分类:
其他好文 时间:
2020-01-08 00:41:28
阅读次数:
92
枚举大家都不陌生,但是最近看到有的人,还在是页面上写死,如果枚举增减时,还要去页面去手动修改,今天我们来看看枚举的处理方式,这里说一下,我用的测试程序是.net core 3.1。 不多墨迹,直接上代码: 定义枚举: 枚举的辅助类,这里说明一下,我是通过获取枚举上的特性来处理的: EnumUtil. ...
An undirected graph is a graph where the pairings representing the edges are _____________. Unordered无序 Two vertices in a graph are ___________ if the ...
分类:
其他好文 时间:
2020-01-07 00:54:31
阅读次数:
61
"https://leetcode cn.com/problems/add two numbers/" 代码如下: ...
分类:
其他好文 时间:
2020-01-07 00:48:56
阅读次数:
62