使用yield和函数式编程转换数组 // 对Array进行转换,获取的还是Array val a = Array(1, 2, 3, 4, 5) val a2 = for (ele <- a) yield ele * ele // 对ArrayBuffer进行转换,获取的还是ArrayBuffer v ...
分类:
编程语言 时间:
2019-08-29 23:17:45
阅读次数:
111
移除第一个负数之后的所有负数 // 构建数组 val a = ArrayBuffer[Int]() a += (1, 2, 3, 4, 5, -1, -3, -5, -9) // 每发现一个第一个负数之后的负数,就进行移除,性能较差,多次移动数组 var foundFirstNegative = f ...
分类:
编程语言 时间:
2019-08-29 22:58:41
阅读次数:
117
创建Map // 创建一个不可变的Map val ages = Map("Leo" -> 30, "Jen" -> 25, "Jack" -> 23) ages("Leo") = 31 // 创建一个可变的Map val ages = scala.collection.mutable.Map("Le ...
分类:
其他好文 时间:
2019-08-29 22:54:49
阅读次数:
87
When using useQuery from Apollo React Hooks, the request will be sent automatically after the component has been mounted. This might not be the desire ...
分类:
其他好文 时间:
2019-08-29 20:29:12
阅读次数:
174
1 # bytes 与 int 2 b=b'\x01\x02' 3 num=int.from_bytes(b,'little') 4 print('bytes转int:',num) 5 6 b1=num.to_bytes(2,'little') 7 print('int转bytes:',b1) 8 ...
分类:
编程语言 时间:
2019-08-29 20:00:29
阅读次数:
302
Remove all elements from a linked list of integers that have value val. Example: 说到删除,首先想到定义两个指针,分别指向要被删除的结点和该结点的前驱结点。这里还需要考虑头结点是需要删除结点的特殊情况。 ...
分类:
其他好文 时间:
2019-08-29 16:19:55
阅读次数:
62
go的常用方法 (1)获取用户屏幕输入的信息 if分支 switch 在golang中匹配项后面不需要加break ...
分类:
其他好文 时间:
2019-08-29 16:12:04
阅读次数:
90
``` Client CropID Secret AppID Logo Save ``` ``` $("#saveInfo").click(function () { var clientName = $("#ClientName").val(); var CropID = $("#CropID")... ...
分类:
Web程序 时间:
2019-08-29 15:51:19
阅读次数:
177
#创建表,设置字段的约束条件 create table employee( id int primary key auto_increment, name varchar(20) not null, sex enum('male','female') not null default 'male',... ...
分类:
数据库 时间:
2019-08-29 09:35:06
阅读次数:
94
题面 https://www.luogu.org/problem/P3808 题解 ...
分类:
其他好文 时间:
2019-08-29 00:05:35
阅读次数:
83